kisazeky Posted April 17, 2009 Share Posted April 17, 2009 I have a loop code that grabs data from the database and lists it on a webpage. $article_title = "Shop"; $article_content = "Shop description goes here.<table<tr>"; $query = "SELECT * FROM adoptables WHERE kind = 'shop'"; $result = mysql_query($query); $num = mysql_numrows($result); //Loop out code $i=0; while ($i < $num) { $aID=@mysql_result($result,$i,"uid"); $name=@mysql_result($result,$i,"name"); $imageurl=@mysql_result($result,$i,"imageurl"); $cost=@mysql_result($result,$i,"description"); //Content output $article_content=$article_content."<td>".$name."<p><img src='".$imageurl."'/><p>".$cost." <p><a href='buy.php?aID=".$aID."'>Buy ".$name."</a></td>"; $i++; } $article_content=$article_content."</tr><tr>"; I want to arrange the data in table columns, with 5 items per row. How can I accomplish this? Link to comment https://forums.phpfreaks.com/topic/154509-php-loop-out-code-help/ Share on other sites More sharing options...
ober Posted April 17, 2009 Share Posted April 17, 2009 http://www.phpfreaks.com/forums/index.php/topic,95426.0.html Link to comment https://forums.phpfreaks.com/topic/154509-php-loop-out-code-help/#findComment-812388 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.