perform update on a table in oracle using php

0

I'm doing a project in php but it does not allow me to perform an update on a table and I tried several times and I get the same error

Warning: oci_parse() expects parameter 1 to be resource, null given in gpersonal.clase.php on line 18 
Warning: oci_execute() expects parameter 1 to be resource, null given in gpersonal.clase.php on line 19 
Warning: oci_commit() expects parameter 1 to be resource, null given in gpersonal.clase.php on line 20

the method I'm using is

$update="UPDATE T_RIESGO SET N_GPMS = 3 WHERE N_CODRIESGO= 1";
        
$stmt = oci_parse($bd, $update);
oci_execute($stmt, OCI_COMMIT_ON_SUCCESS);
oci_commit($bd);

The N_GPMS and N_CODRIESGO columns are number

could help me please and try in various ways and I can not get it to work correctly

    
asked by Alvaro vargas astorga 11.08.2017 в 23:58
source

1 answer

0

I do not know if you need to paste the connection code or that it contains the $ bd, but you must make the connection in this way:

$bd = oci_connect("userName","password","hostName");  

if possible and the most recommended is that you generate validation that if the connection is well made

if ($bd=oci_connect("username", "password", "hostName")){
    echo "Successfully connected to Oracle.\n";
  } else {
    $err = OCIError();
    echo "Oracle Connect Error " . $err[text];
  }
    
answered by 12.08.2017 в 06:23