| 
 Posted by Zoe Blade on 01/22/06 16:14 
> Does anyone know of an efficient way to retreive data from a mysql db 
> and display the record rows as collumns? 
 
You're probably best off putting each record row in an array, so you'd get 
something like: 
 
while ($row = mysql_fetch_array($result)) 
{ 
  $rows[] = $row; 
} 
 
That way, you'll have access to all the results before you start drawing 
your table. Then for each row of the table you print out, you can loop 
through the array printing out the appropriate column of SQL output. 
 
foreach ($rows as $row) 
{ 
  echo "<td>{$row['column_1']}</td>"; 
} 
 
Perhaps something like that might work? 
 
Hope that helps, 
Zoe.
 
[Back to original message] 
 |