Jump to content

Archived

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

cheyner11

creating colums in PHP

Recommended Posts

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

Share this post


Link to post
Share on other sites
[!--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]

Share this post


Link to post
Share on other sites
.. Not nearly enough info on what you need to have done..

Here you go?

[code]$x = "hi";
$y = "to";
$z = "you";

print "$x | $y | $z";
[/code]

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

×

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.