another PHP Sql question...

From: Date: Fri, 29 Aug 2003 14:14:27 +0000
Subject: another PHP Sql question...
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-30230@lists.php.net to get a copy of this message
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 */
        }
     }


« previous php.db (#30230) next »