Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: php and oracle

  1. #1
    New Coder
    Join Date
    Jul 2002
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    php and oracle

    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, aediatrician, :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,"aediatrician",&$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

  • #2
    Regular Coder
    Join Date
    Jul 2002
    Posts
    226
    Thanks
    0
    Thanked 0 Times in 0 Posts
    im no expert but looking at line 29 i see a smiley in your code...is that your problem?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •