note 7139 modified in ref.oracle by irchtml

From: Date: Tue, 17 Feb 2004 14:33:57 +0000
Subject: note 7139 modified in ref.oracle by irchtml
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-65302@lists.php.net to get a copy of this message
I contribute the following code example. function GetNameFromUserId ($ID, &$User, &$Msg) { print('<BR>GetNameFromUserId Start'); if ($Session = ora_plogon('Hello', 'World')) { print('<P>Session: ' . $Session . '<P>'); if ($Cursor = ora_open($Session)) { print('<P>Cursor: ' . $Cursor . '<P>'); $SQL = 'SELECT NAME FROM PERSONS WHERE USERID = \'' . $ID . '\''; print('<P>SQL: ' . $SQL . '<P>'); // Prepare SQL statement if (ora_parse($Cursor, $SQL)) { if (ora_exec($Cursor)) { $Row[] = ''; // Retrieve a complete row from the result set if (ora_fetch_into($Cursor, &$Row)) { $User = 'count = ' . count($Row) . ': '; while (list($Key, $Value) = each($Row)) { $User .= '<BR>Row[' . $Key . '] = ' . $Value; } $Result = 0; } else { $Msg = ora_error($Cursor); $Result = ora_errorcode($Cursor); } // end of if expression } else { $Msg = ora_error($Cursor); $Result = ora_errorcode($Cursor); } // end of if expression } else { $Msg = ora_error($Cursor); $Result = ora_errorcode($Cursor); } // end of if expression ora_close($Cursor); } else { $Msg = ora_error($Session); $Result = ora_errorcode($Session); } // end of if expression ora_logoff($Session); } else { $Msg = ora_error($Session); $Result = ora_errorcode($Session); } // end of if expression print('<BR>GetNameFromUserId End'); return $Result; } --was-- I contribute the following code example. <PRE> function GetNameFromUserId ($ID, &$User, &$Msg) { print('<BR>GetNameFromUserId Start'); if ($Session = ora_plogon('Hello', 'World')) { print('<P>Session: ' . $Session . '<P>'); if ($Cursor = ora_open($Session)) { print('<P>Cursor: ' . $Cursor . '<P>'); $SQL = 'SELECT NAME FROM PERSONS WHERE USERID = \'' . $ID . '\''; print('<P>SQL: ' . $SQL . '<P>'); // Prepare SQL statement if (ora_parse($Cursor, $SQL)) { if (ora_exec($Cursor)) { $Row[] = ''; // Retrieve a complete row from the result set if (ora_fetch_into($Cursor, &$Row)) { $User = 'count = ' . count($Row) . ': '; while (list($Key, $Value) = each($Row)) { $User .= '<BR>Row[' . $Key . '] = ' . $Value; } $Result = 0; } else { $Msg = ora_error($Cursor); $Result = ora_errorcode($Cursor); } // end of if expression } else { $Msg = ora_error($Cursor); $Result = ora_errorcode($Cursor); } // end of if expression } else { $Msg = ora_error($Cursor); $Result = ora_errorcode($Cursor); } // end of if expression ora_close($Cursor); } else { $Msg = ora_error($Session); $Result = ora_errorcode($Session); } // end of if expression ora_logoff($Session); } else { $Msg = ora_error($Session); $Result = ora_errorcode($Session); } // end of if expression print('<BR>GetNameFromUserId End'); return $Result; } </PRE> http://www.php.net/manual/en/ref.oracle.php

« previous php.notes (#65302) next »