Jump to content

need help with results of db query ...


dr.zick

Recommended Posts

ok this should be easy but i'm having some trouble ... i'm taking the results of a query (4 record) and i want to split the results into a table row (tr) with 3 cells (td) and after the 3rd cell start a new row. so seeing as there is 4 records that means one full row with 1 record in a second row. however my script keeps putting all the records in the same row. i'm not sure how to fix this. here's my code:[code]
echo "<tr height=\"128\">\n";
while ($row=mysql_fetch_array($result)){
for ($i=1; $i<3; $i++){
echo "<td width=\"33%\" valign=\"bottom\">",  $row['name'], "</td>\n";
}
}
echo "</tr>";[/code]

see it in action at: [a href=\"http://about:blank\" target=\"_blank\"]here[/a]

any help would be awesomely appreciated.
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.