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 Jacob A. van Zanen other posts by this author
Aug 29 2003 8:13AM messages near this date
[PHP-DB] another PHP Sql question... | RE: [PHP-DB] delte stmt problem with joins
One question:

Do you mean that a & b are from the same column but are row 1 & 2 from
your query result.?

If so, you can possibly write a loop like so

Dump all your records in an array;
Start loop for as long you find records in array
{
	Take the first record from your array and dump it into a
variable (var1);
	Move the value from the variable var1 to another variable
(var2);
	If both variables are set
	{
		Print the two variables with the html tags you want;
		Unset both variables;
	}
}
Add a handler to make sure you get the last records if it happens to be
an od number off records;


You'll have to do your own coding around this logic.


Good luck


Jack


-----Original Message-----
From: jsWalter [mailto:jsWalter@[...].ws] 
Sent: Friday, August 29, 2003 9:46 AM
To: php-db@[...].net
Subject: Re: [PHP-DB] another PHP Sql question...


>  "Boaz Yahav" <berber@[...].il> wrote in message
>  I'm not sure i understand the problem.
>   a,c,e come from one query result and b,d,f from another?

No, they all come from the same table, but the same field name but from
different rows of the database.


>  If it's all from the same query why not do :
> 
>  reult=mysql_query(".....
>  <TABLE>
>  While($row = mysql_fetch_object($result)) {
>      Echo"<TR><TD>$row->feild_A</TD><TD>$row->feild_B</TD></TR>";
>  }
>  </TABLE>

This method does not grap data from 2 rows at atime.

I examined my example and noticed I goofed, it should have read...

...

   <tr> 
      <td> row_1/field_A</td>
      <td> row_2/field_A</td>
   </tr> 
   <tr> 
      <td> row_3/field_A</td>
      <td> row_4/field_A</td>
   </tr> 

Same field, but diffeent rows.

Sorry for the confusion.

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

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