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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.