jake_ms Posted April 19, 2007 Share Posted April 19, 2007 Hi all, its giving me a parse error but I'm not too sure where the mistake is? Could someone please take a look and explain where I've gone wrong? Thanks very much $staffno = $_POST["staffnodelete"]; IF ($staffnodelete=="" ) {print "You have deleted $staffname ";} putenv("TNS_ADMIN=/u1/oracle/Products/shu10g/network/admin"); $con = OCILogon("username","password","DB"); $query = ("Delete from Staff where staffno = $staffnodelete"); //(" . $name . ")" $stmt = OCIParse($conn, $query) or die ('Can not parse query'); OCIBindByName($stmt,":var_no", &$no,50) or die ('Can not bind variable'); OCIExecute($stmt, ":var_no", &$name,50) or die ('Can not Execute statement'); OCIFreeStatement($stmt); OCILogoff($con); echo "$no"; Link to comment https://forums.phpfreaks.com/topic/47732-trying-to-delete-a-database-row-via-php/ Share on other sites More sharing options...
Michael Lasky Posted April 19, 2007 Share Posted April 19, 2007 You're trying to bind 2 variables to the oracle placeholder :var_no. And with the second one you're calling ociExecute instead of ociBindByName. Try replacing OCIBindByName($stmt,":var_no", &$no,50) or die ('Can not bind variable'); OCIExecute($stmt, ":var_no", &$name,50) or die ('Can not Execute statement'); with OCIBindByName($stmt,":var_no", $no, -1) or die ('Can not bind variable'); // <-- repeat this for each variable. Each one should have a different place holder. OCIExecute($stmt) or die ('Can not Execute statement'); Might help if you specify which line you get the parse error on and the actual error message. Link to comment https://forums.phpfreaks.com/topic/47732-trying-to-delete-a-database-row-via-php/#findComment-233140 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.