Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2003
    Posts
    8

    Unhappy Unanswered: Strange PHP and Oracle Problem

    I have a rather wierd problem with PHP and Oracle. I am using Oracle9i with PHP, however, I am unable to see any new rows inserted into the database from PHP. These steps can reproduce the problem each time:

    1) Logon to Oracle from a shell with sqlplus.
    2) Insert a row into a table (any table, I've tried very complex tables to ones with just one column).
    3) Attempt to select this data from PHP even with a very simple script that just connects, parses, executes, and fetches the data, however no data will be fetched.
    4) Thinking that I screwed up the SQL (despite its amazing simplicity), I copy/paste the SQL into sqlplus and it returns the data just as it should.

    The only thing that I have found that will allow me to see the new data in PHP is to alter the table (even if I don't actually change any values, i.e. altering a varchar2(50) to varchar2(50)). Once the alter happens, I am able to see the new data, but then I am not able see any of the new rows that I insert after the altering.

    Is there some type of strange caching/buffering that is happening here that is only updating the data that PHP sees when an alter happens?

    Sorry if some of this doesn't make a lot of sense, its really late and I am starting to see doubles due to my overloaded frustration. Any help would be immensely appreciated. Thanks in advance.

  2. #2
    Join Date
    Oct 2003
    Location
    Slovakia
    Posts
    482

    Re: Strange PHP and Oracle Problem

    Originally posted by DaCypher
    I have a rather wierd problem with PHP and Oracle. I am using Oracle9i with PHP, however, I am unable to see any new rows inserted into the database from PHP. These steps can reproduce the problem each time:

    1) Logon to Oracle from a shell with sqlplus.
    2) Insert a row into a table (any table, I've tried very complex tables to ones with just one column).
    3) Attempt to select this data from PHP even with a very simple script that just connects, parses, executes, and fetches the data, however no data will be fetched.
    4) Thinking that I screwed up the SQL (despite its amazing simplicity), I copy/paste the SQL into sqlplus and it returns the data just as it should.

    The only thing that I have found that will allow me to see the new data in PHP is to alter the table (even if I don't actually change any values, i.e. altering a varchar2(50) to varchar2(50)). Once the alter happens, I am able to see the new data, but then I am not able see any of the new rows that I insert after the altering.

    Is there some type of strange caching/buffering that is happening here that is only updating the data that PHP sees when an alter happens?

    Sorry if some of this doesn't make a lot of sense, its really late and I am starting to see doubles due to my overloaded frustration. Any help would be immensely appreciated. Thanks in advance.
    Two possible reasons:

    1. Did you COMMIT the transaction?
    After insert query in sqlplus or whatever you must execute the COMMIT statement.

    2. In ociresult (in PHP) function must be all column names in uppercase format!

  3. #3
    Join Date
    Jul 2003
    Location
    Jersey
    Posts
    11

    Re: Strange PHP and Oracle Problem

    Originally posted by ika
    Two possible reasons:

    1. Did you COMMIT the transaction?
    After insert query in sqlplus or whatever you must execute the COMMIT statement.

    2. In ociresult (in PHP) function must be all column names in uppercase format!
    Like he said, with Oracle and PHP, you've gotta do a Commit. (i had the same problem... hope that solves yours)

    If you do an insert in SQLplus and dont do a commit and try to do a select in PHP i'm pretty sure it should not be avalible to php until the data is commited aswell. (fun little things to try...)
    Last edited by rweston002; 01-08-04 at 15:26.

Posting Permissions

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