Results 1 to 5 of 5

Thread: Mystery Function - say what?

  1. #1
    Join Date
    Sep 2007
    Location
    Maui
    Posts
    642
    Thanks
    284
    Thanked 15 Times in 15 Posts

    Default Mystery Function - say what?

    I just moved a domain to a new host and the existing code is having some problems on the new server, probably due to newer versions of MySQL and php. I know minimal php, only what I learned trying to do css.

    This function is causing a warning message in the error log:

    Code:
    function dbi_fetch_row ( $res ) {
      if ( strcmp ( $GLOBALS["db_type"], "mysql" ) == 0 ) {
        return mysql_fetch_array ( $res );
      } else if ( strcmp ( $GLOBALS["db_type"], "oracle" ) == 0 ) {
        if ( OCIFetchInto ( $GLOBALS["oracle_statement"], &$row,
          OCI_NUM + OCI_RETURN_NULLS  ) )
          return $row;
        return 0;
      } else if ( strcmp ( $GLOBALS["db_type"], "postgresql" ) == 0 ) {
        if ( $GLOBALS["postgresql_numrows"]  > $GLOBALS["postgresql_row"] ) {
            $r =  pg_fetch_array ( $res, $GLOBALS["postgresql_row"] );
            $GLOBALS["postgresql_row"]++;
            if ( ! $r ) {
                echo "Unable to fetch row\n"; 
                return '';
            }
        }
        else {
            $r = '';
        }
        return $r;
      } else if ( strcmp ( $GLOBALS["db_type"], "odbc" ) == 0 ) {
        if ( ! odbc_fetch_into ( $res, $ret ) )
          return false;
        return $ret;
      } else {
        dbi_fatal_error ( "dbi_fetch_row(): db_type not defined." );
      }
    }
    Error Log:
    PHP Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of [runtime function name](). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in /hermes/web03/server/htdocs/php/php-dbi.php on line 151.

    I would rather update the code than change the php.ini. I just don't know how. Can someone please push me in the right direction?

    Thanks, erin

  2. #2
    Join Date
    Mar 2008
    Posts
    218
    Thanks
    7
    Thanked 19 Times in 19 Posts

    Default

    The problem lies here: &$row. Try using it without &

  3. The Following User Says Thank You to tfit For This Useful Post:

    kuau (05-12-2008)

  4. #3
    Join Date
    Sep 2007
    Location
    Maui
    Posts
    642
    Thanks
    284
    Thanked 15 Times in 15 Posts

    Default

    Dear tfit:

    That was it!! I just deleted the "&" and no more error messages! Yahoo! I have no idea what any of it means, but as long as it works, fine by me.

    Thanks a million! Erin

  5. #4
    Join Date
    May 2008
    Posts
    17
    Thanks
    1
    Thanked 4 Times in 4 Posts

    Default

    Also, changing the PHP.ini file is easy.

    Don't let the .ini extension trick you, it's just a text file. Open it in Notepad/(your editor here).

    Then, let's say you need to set allow_call_time_pass_reference to true, add this line, towards the top-ish, but not with a #:

    allow_call_time_pass_reference = true

    Sometimes you have to change your php.ini file, so it's best you learn how now, in case you need the information later.

    Other than that, you seem to be a pretty informed PHP coder.

  6. The Following User Says Thank You to shotgun_ninja For This Useful Post:

    kuau (05-16-2008)

  7. #5
    Join Date
    Sep 2007
    Location
    Maui
    Posts
    642
    Thanks
    284
    Thanked 15 Times in 15 Posts

    Default

    Dear Shotgun:

    Thanks for the compliment but unfortunately it is unearned. I may understand programming logic, but php is a new language for me so I really am illiterate. I am just a fairly good mimmick. I am always nervous about changing something with such far-reaching repercussions as the php.ini file when I don't fully understand what a setting is for (eg. call_time_pass_reference), especially if there is indication that something is deprecated. I would be lost without the people on this forum (understatement). I learn so much here. I really appreciate everyone's willingness to share what they know. Thanks very much. Aloha, erin

Bookmarks

Posting Permissions

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