RE: another PHP Sql question...

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

 



I'm not sure i understand the problem.
Do a,c,e come from one query result and b,d,f from another?
If it's all from the same query why not do :

$result=mysql_query(".....
<TABLE>
While($row = mysql_fetch_object($result)) {
    Echo"<TR><TD>$row->feild_A</TD><TD>$row->feild_B</TD></TR>";
}
</TABLE>

Sincerely
 
berber
 
Visit http://www.weberdev.com/ Today!!!
To see where PHP might take you tomorrow.
Share your code : http://addexample.weberdev.com
Search for PHP Code from your browser http://toolbar.weberdev.com


-----Original Message-----
From: jsWalter [mailto:jsWalter@torres.ws] 
Sent: Friday, August 29, 2003 8:14 AM
To: php-db@lists.php.net
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