Re: works under mysql 5 but not under Oracle 11g1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





--- On Mon, 11/24/08, Fred Silsbee <fredsilsbee@xxxxxxxxx> wrote:

> From: Fred Silsbee <fredsilsbee@xxxxxxxxx>
> Subject: Re:  works under mysql 5 but not under Oracle 11g1
> To: "Chris" <dmagick@xxxxxxxxx>
> Cc: php-db@xxxxxxxxxxxxx
> Date: Monday, November 24, 2008, 2:44 PM
> --- On Mon, 11/24/08, Chris <dmagick@xxxxxxxxx> wrote:
> 
> > From: Chris <dmagick@xxxxxxxxx>
> > Subject: Re:  works under mysql 5 but not
> under Oracle 11g1
> > To: fredsilsbee@xxxxxxxxx
> > Cc: php-db@xxxxxxxxxxxxx
> > Date: Monday, November 24, 2008, 6:41 AM
> > Fred Silsbee wrote:
> > 
> > >     while ($newArray = oci_fetch_assoc($result))
> {
> > >         foreach ($fields as $field){             
>     
> >        ${$field} = $newArray[$field];        // values
> not
> > making it into variable
> > >                      }                           
>     
> >         
> > 
> > print_r($newArray);
> > 
> > what is here?
> > 
> > Oracle uppercases all fields, tablenames by default
> (per
> > sql spec).
> > 
> > -- Postgresql & php tutorials
> > http://www.designmagick.com/
> 
> 
> That code showed all...THANKS!
> 
> The data is being extracted but not making it to the
> variables.
> 
>     while ($newArray = oci_fetch_assoc($result)) {
>         print_r($newArray);                 //
> everything!!! is there
>         foreach ($fields as $field){
>             ${$field} = $newArray[$field];    //
> here...works under MySQL
>         }


fixed the problem but am not fully sure of the optimum code one should use!

I like the association idea but must change the $fields array

There is a better way than using count!

67     //get log_book_id table information
     68     $user = "select * from log_book_id";
     69     $result = oci_parse($conn, $user);
     70         $r = oci_execute($result);
     71
     72     //display log_book_id information
     73
     74     while ($newArray = oci_fetch_row($result)) {
     75 //      print_r($newArray);
     76     $count = 1;
     77         foreach ($fields as $field){
     78             ${$field} = $newArray[$count];
     79                 $count = $count +1;
     80 //              print_r(${$field});
     81 //              print_r($newArray[$field]);
     82         }
     83         $rowID = $newArray[0];
     84
     85         //note that we do not rely on the checkbox value as not all browsers submit it
     86         //instead we rely on the name of the checkbox.
     87         echo <<<HTML
     88     <TR>
     89         <td>
     90             <input type="checkbox" name="checkbox[$rowID]" value="$rowID">Check to delete record
     91         </td>
     92         <TD>$rowID</TD>
     93         <TD>$fdate</TD>
     94         <TD>$actype</TD>
     95         <TD>$acid</TD>
     96         <TD>$nlandings</TD>
     97         <TD>$nhours</TD>
     98     </TR>



      


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux