Hi all, When i echo the results they come out in a list, for example - a a a a a How can i get them to display like this - a a a a a a basicly i want results in a two column table !
You will need to: Table tag and initial row (<table><tr>) Set a $counter = 0; For every output, output "<td>{$output}</td>"; Add $counter + 1; For every "even" counter output "</tr><tr>"; Check using: if (($counter % 2) == 0){ echo "</tr><tr>"; } PHP: I hope this gives the general idea of how it can be accomplished. Jay
how would i work that into this - mysql_select_db("****_****", $con); echo "<table border='1'>"; $result = mysql_query("SELECT ***** blah***** Limit 6"); while($row = mysql_fetch_array($result)) { echo "<tr><td>"; echo "<img src='http://www.****/images/***/"; echo $row['m_id']; echo "-"; echo $row['i_id']; echo ".jpg' />"; echo "</td></tr>"; }mysql_close($con); echo "</table>"; ?> PHP: do you have any good tutorials on this ? i have googled to much
Try this one mysql_select_db("****_****", $con); echo "<table border='1'>"; $result = mysql_query("SELECT ***** blah***** Limit 6"); $counter = 0; while($row = mysql_fetch_array($result)) { if($counter == 2) { $counter = 0; } if ($counter == 0){ echo "<tr>"; } echo "<td>"; echo "<img src='http://www.****/images/***/"; echo $row['m_id']; echo "-"; echo $row['i_id']; echo ".jpg' />"; echo "</td>"; if ($counter == 1){ echo "</tr>"; } $counter++; } mysql_close($con); echo "</table>"; ?> PHP: