Re: another PHP Sql question...

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

 



 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 />';
     }

Tiberiu

----- Original Message ----- 
From: "jsWalter" <jsWalter@torres.ws>
To: <php-db@lists.php.net>
Sent: Friday, August 29, 2003 8:14 AM
Subject:  another PHP Sql question...


> I am querying a database just fine.
>
> Getting back what I expect, just fine.
>
> But now I've been thrown a wrench in the form of double row display.
>
> my client wants...
>
>     a   b
>     c   d
>     e   f
>    ...
>
> Well, I've reached the end on my PHP/SQL knowledge (which really isn't all
> that far!)
>
> Right now I'm doing (very much shortened)...
>
>    // Query the database
>    $result = $db->query($strSql);
>
>    // Always check that $result is not an error
>    if (DB::isError($result))
>       die ($result->getMessage());
>
>    while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
>    {
>       extract ($row);
>       echo $feild_A . '<br />';
>    }
>
> OK, this is fine for a straight list!
>
> But I need to create...
>
>    <tr>
>       <td>row_1/feild_A</td>
>       <td>row_1/feild_B</td>
>    </tr>
>    <tr>
>       <td>row_2/feild_A</td>
>       <td>row_2/feild_B</td>
>    </tr>
>    ...
>
> And using the method of WHILE() doesn't cut it.
>
> Can some one enlighten me what syntax can I use to hit 2 rows at a time?
>
> Thanks
>
> Walter
>
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

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