I think he meant that he is only pulling one column, i.e. "field1" with each
mysql_fetch_array and he wants that in four columns.

$c = 1;
echo "<tr>";
while($ar = mysql_fetch_array($result))
{
  echo "<td>{$ar['field1']}</td>";
  if(($c % 4) == 0) { echo "</tr><tr>"; }
}

You'll have to account for incomplete rows and clean up the output, but
hopefully that gives you an idea.

---John Holmes...

----- Original Message -----
From: "Ryan Jameson (USA)" <[EMAIL PROTECTED]>
To: "Art Chevalier" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, December 05, 2002 3:05 PM
Subject: RE: [PHP-DB] MySQL Array


while ($ar = mysql_fetch_array($rs))
  echo "<tr><td>". $ar['field1']."</td><td>".$ar['field2']."</td></tr>";


Make sense?

-----Original Message-----
From: Art Chevalier [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 05, 2002 12:44 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MySQL Array


Hello,

I am pulling one column out of a MySQL table in an array.  I want to place
each element into a HTML table 4 rows across.  I am currently doing this
with the mysql_fetch_array() function. How can I pull out 4 array elements
in one pass through a while loop?

Thanks

Art Chevalier



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


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to