jaxbrian
asked on
Trying to print 3 columns of data from mysql with php
I am trying to print rows from a database into three columns and then be able to print them in three columns as well. the below code is what I am using to display the three columns but when I try to print them. it doesn't want to print them correctly. it only displays some of the rows in the print preview. any suggestions? I have tried creating a print CSS and force it to break on an tag but I haven't had any luck with it.
$data = mysql_query("SELECT * FROM test") ;
$data_count = mysql_num_rows($data);
$div_open = '<div style="float:left;margin-left:30px;">';
$div_close = '</div>';
print $div_open;
print "<ul>";
for ( $i = 0; i < 150 && $i < $data_count; $i ++)
{
if ($i % 50 == 0 && $i > 1)
{
print $div_close;
print $div_open;
print "<ul>";
}
$info = mysql_fetch_array( $data );
print "<tr><td>" . $info['1'] . " " . $info['2'] . " " . "</td><td>" . $info['3'] . "</td></tr><br>";
}
print "</ul>";
print $div_close;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ok, I have it doing what I wanted it to do. it was combination of both your answers plus some more tweaking.
thank you guys very much for your time and input
thank you guys very much for your time and input
ASKER
it was just one guy but ... lol
ASKER