ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-db
php-db
RE: [PHP-DB] another PHP Sql question...
by Boaz Yahav other posts by this author
Aug 29 2003 8:19AM messages near this date
RE: [PHP-DB] weird php error | Re: [PHP-DB] another PHP Sql question...
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@[...].ws] 
Sent: Friday, August 29, 2003 8:14 AM
To: php-db@[...].net
Subject: [PHP-DB] 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
Thread:
Boaz Yahav
jsWalter

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved