Re: another PHP Sql question...

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

 



At 09:33 AM 8/29/2003, you wrote:
>  You can do:
>     while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
>      {
>         extract ($row);
>         echo $feild_A . '&nbsp';
>
>         $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
>         extract ($row);
>         echo $feild_A . '<br />';
>      }

close, but doesn't handle odd row counts...

      while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
      {
         extract ($row);
         echo $feild_A;

         if( $row = $result->fetchRow(DB_FETCHMODE_ASSOC) )
         {
             extract ($row);
             echo '&nbsp' . $feild_A . '<br />';
         }
         else
         {
             echo '<br />';
             /* optionally, add a 'last' here to skip extra db->call */
         }
      }

--
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