...

php and oracle

hendryk
07-30-2002, 05:20 PM
Hi,

This is my php script. I am trying to insert data into my oracle database but I am getting the following warning messages and none of the data is going into my database.
Does anyone know what they mean or what I've done wrong.

K

<?php
putenv("ORACLE_HOME=/usr/local/oracle/product/8.1.7");
putenv("ORACLE_SID=Lev3");
putenv("ORACLE_BASE=/usr/local/oracle");
$conn=OCILogon("it2001_hendryk","salehj1","it");

$hospNo = "1";
$paediatrician ="Dr Wilson";
$nurse ="Miss Jones";


//2)Build the insert statement

$addPatient = " INSERT INTO patient (hospNo, paediatrician, nurse)

VALUES (:hospNo, :paediatrician, :nurse)";

//3)Set up query for execution with the function OCIParse().
//OCIParse will return a statement identifier, we can use it to check for any errors
//that came back when attempting to parse the query string

$iStatement =OCIParse($conn,addPatient);


//4) Use OCIBindByName() to bind a specific value to each placeholder

//bind the variables to our placeholders

OCIBindByName($iStatement ,":hospNo", &$hospNo, 7);
OCIBindByName($iStatement,":paediatrician",&$paediatrician,30);
OCIBindByName($iStatement,":nurse", &$nurse,30);

//This provides us with two major benefits. First,it gets rid of the
//problem of having to use addslashes() to escape any single quotes
//in our data, and it also inserts a null into a column rather than an empty
//string

$result = OCIExecute($iStatement, OCI_DEFAULT);
echo "$result";
OCILogoff($conn);

?>


Warning: OCIBindByName: ORA-01036: illegal variable name/number in /export/local/www.proj/html/students/MScIT/hendryk/test.php on line 29

Warning: OCIBindByName: ORA-01036: illegal variable name/number in /export/local/www.proj/html/students/MScIT/hendryk/test.php on line 30

Warning: OCIBindByName: ORA-01036: illegal variable name/number in /export/local/www.proj/html/students/MScIT/hendryk/test.php on line 31

Warning: OCIStmtExecute: ORA-00900: invalid SQL statement in /export/local/www.proj/html/students/MScIT/hendryk/test.php on line 38

Squintz
07-30-2002, 05:30 PM
im no expert but looking at line 29 i see a smiley in your code...is that your problem?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum