Jump to content

creating colums in PHP


cheyner11

Recommended Posts

[!--quoteo(post=355235:date=Mar 15 2006, 12:13 AM:name=cheyner11)--][div class=\'quotetop\']QUOTE(cheyner11 @ Mar 15 2006, 12:13 AM) [snapback]355235[/snapback][/div][div class=\'quotemain\'][!--quotec--]
I need some help columizing data into three rows.

what would the PHP code be to create a data print like the following:

data A | data B | data C

Thanks for your help
[/quote]

[code]
<?php

$sql = "SELECT a, b, c FROM T";

$result = mysql_query($sql) or die(mysql_error());

print "<table>";
while ($row = mysql_fetch_assoc($result)
   print "<tr><td> $row['a'] </td><td> $row['b'] </td> <td> $row['c']</td></tr>";

print "</table>";
?>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/5011-creating-colums-in-php/#findComment-17736
Share on other sites

sorry. I mean that I need the data to be columnized into three rows, whereas there is no limit to the amount of data. So if there were 8 rows in a database, I would need it to print:

Row 1 | Row 2 | Row 3
Row 4 | Row 5 | Row 6
Row 7 | Row 8

Link to comment
https://forums.phpfreaks.com/topic/5011-creating-colums-in-php/#findComment-18243
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.