So i hope this posts correctly (1st time posting). I have a form and am trying to post to an Oracle 11g db using a stored procedure. I can:
- echo the data submitted to the form via POST
- insert data directly into the database from sqlplus
a. typing following into sqlplus:SQL> call InsertCustomerAndInterests ('bond','james','007','000-0000','[email protected]','england');
so the individual components work, but I am having a problem (I think) with how I am stringing the text together from within the insertUser.php script (below). I have been at this a long time and would love to see this insert into the database. It is possible i am calling the stored procedure incorrectly. not sure where the problem lies. reading other posts, i know this is subject to sql injection and has no error checking on the php side … i don’t care (yet). i just want it to work.
[php]
<?php /* Set Variables */ $lname=$_POST["lname"]; $fname=$_POST["fname"]; $area_code=$_POST["area_code"]; $phone=$_POST["phone"]; $email=$_POST["email"]; $nationality=$_POST["nationality"]; /* Connect to the Oracle DB */ $connection = ocilogon("uname","password","host.domain.com"); #this does work //$connection = ocilogon("[email protected]/password"); #doesn't work if (!$connection) { echo "Couldn't make a connection."; exit; } else { echo "Connected! (Oracle Database)"; } /* Define SQL */ //FROM SQLPLUS PROMPT: //call InsertCustomerAndInterests ('bond','james','007','000-0000','[email protected]','england'); /* try1 */ //$sql = "CALL InsertCustomerAndInterests(' .$lname . ',' .$fname . ',' .$area_code . ',' .$phone . ',' .$email . ',' .$nationality . ')"; /* try2 */ //$sql = "CALL InsertCustomerAndInterests(' .$lname .',' .$fname .',' .$area_code .',' .$phone .',' .$email .',' .$nationality .')"; /* Kinda Works */ $sql = "CALL InsertCustomerAndInterests(' .$lname . ',' .$fname . ',' .$area_code . ',' .$phone . ',' .$email . ',' .$nationality .')"; /* Peek into data */ echo $lname . ' ' .$fname . ' ' .$area_code . ' ' .$phone . ' ' .$email . ' ' .$nationality; $stmt = oci_parse($connection,$sql); oci_close($connection); ?>
[/php]