Jump to content

Trying to delete a row


jake_ms

Recommended Posts

This should be simple enough but for some reason it's not working. The $name is a number which is being posted across when the user clicks submit. I want the PHP to then access the Database with this number and use it to delete the staff ID (which is a PK).

With this code I get the error:

 

Warning: ociparse(): supplied argument is not a valid OCI8-Connection resource in /homedir/ilex-s01/jmsuther/public_html/DeleteStaff.php on line 16

 

Warning: ociexecute(): supplied argument is not a valid OCI8-Statement resource in /homedir/ilex-s01/jmsuther/public_html/DeleteStaff.php on line 17

;

 

The code is:

 

$name = $_POST["staffnodelete"];

IF ($staffnodelete=="" )

{print "You selected $name - for deletion ";}

 

putenv("TNS_ADMIN=/u1/oracle/Products/shu10g/network/admin");

$con = OCILogon("username","password","10g");

 

$query = "DELETE FROM staff WHERE staffno = $name";

$query = $query_post [$name];

$stmt = ociparse($conn, $query);

ociexecute ($stmt);

 

Any help'd be much appreciated. Thanks

Link to comment
https://forums.phpfreaks.com/topic/47875-trying-to-delete-a-row/
Share on other sites

Just check once these apis for test only

oci_connect

(PHP 5)

 

oci_connect -- Establishes a connection to the Oracle server

Description

resource oci_connect ( string username, string password [, string db [, string charset [, int session_mode]]] )

-----------------------------------------------------------------------------------------

oci_parse

(PHP 5)

 

oci_parse -- Prepares Oracle statement for execution

Description

resource oci_parse ( resource connection, string query )

--------------------------------------------------------------------------------

oci_execute

(PHP 5)

 

oci_execute -- Executes a statement

Description

bool oci_execute ( resource stmt [, int mode] )

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.