PHP Oracle Errors with Double quotes?
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: PHP Oracle Errors with Double quotes?

  1. #1
    Join Date
    Feb 2007
    Location
    Sin City
    Posts
    3

    Unhappy PHP Oracle Errors with Double quotes?

    I'm new to Oracle and am trying to pull information from Oracle into a web page.

    PHP Version 5.2.1
    Apache 2.0.55

    When I just do a basic query the results return fine but when I use double quotes in my php to I can include a WHERE statment I start getting errors
    here are 2 examples of the code i'm using:

    Works But can't use a WHERE statment:
    $db_conn = ocilogon("xxxxxx", "xxxxxx", "xxxxxx");
    $cmdstr = 'select app_user from application$_user';

    $parsed = ociparse($db_conn, $cmdstr);
    ociexecute($parsed);

    Doesn't work with Double Quotes in the query:
    $db_conn = ocilogon("xxxxxx", "xxxxxx", "xxxxxxx");
    $cmdstr = "select app_user from application$_user where app_user = 'BLAH'";

    $parsed = ociparse($db_conn, $cmdstr);
    ociexecute($parsed);


    Any help would be greatly appreciated.



    -

    here is a copy of the error

    Warning: ociexecute() [function.ociexecute]: ORA-00942: table or view does not exist in C:\Program Files\Apache Group\Apache2\htdocs\opera\myconnectiontest7.php on line 7
    Last edited by csolano702; 02-14-2007 at 03:15 PM.

  2. #2
    Join Date
    Sep 2002
    Location
    England
    Posts
    7,333
    $cmdstr = 'select app_user from application$_user where app_user = ''BLAH''';

  3. #3
    Join Date
    Feb 2007
    Location
    Sin City
    Posts
    3
    Thanks for the responce.. I tried the query but php is barking at me for it.
    $cmdstr = 'select app_user from application$_user where = "BLAH"';

    Error:
    Warning: ociexecute() [function.ociexecute]: ORA-00904: "BLAH": invalid identifier in C:\Program Files\Apache Group\Apache2\htdocs\opera\myconnectiontest7.php on line 7

    Warning: ocifetchstatement() [function.ocifetchstatement]: ORA-24374: define not done before fetch or execute and fetch in C:\Program Files\Apache Group\Apache2\htdocs\opera\myconnectiontest7.php on line 9

    This is so confusing I know I should be able to use double quotes and it works fine with Sql, I wonder if it is maybe a configuration change that needs to be done in php.ini??

  4. #4
    Join Date
    Feb 2007
    Location
    Sin City
    Posts
    3
    problems solved.

    I had to change (application$_user)
    $blah = 'application$_user';
    $cmdstr = "select app_user from $blah where(app_user LIKE '%$search%')";

Posting Permissions

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



Click Here to Expand Forum to Full Width