Jump to content


Photo

need help with results of db query ...


  • Please log in to reply
3 replies to this topic

#1 dr.zick

dr.zick
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 22 June 2006 - 02:12 AM

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:
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>";

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

any help would be awesomely appreciated.

#2 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 22 June 2006 - 02:20 AM

There is a snippet in the [a href=\"http://www.phpfreaks.com/forums/index.php?showforum=41\" target=\"_blank\"]FAQ/CODE Snippet Repository[/a].

#3 dr.zick

dr.zick
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 22 June 2006 - 02:40 AM

i'm stupid ...

#4 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 22 June 2006 - 02:41 AM

Sorry.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users