Stalingrad Posted July 26, 2012 Share Posted July 26, 2012 Hi! This is probably simple, and I know it is, I just need my memory refreshed at this point. I will show you the data I want to grab in a minute. I want to display the data like this: NAME NAME NAME NAME IMAGE IMAGE IMAGE IMAGE NAME NAME NAME NAME IMAGE IMAGE IMAGE IMAGE etc...(it will ocntinue on with whatever is in the table, and stop when the data stops). I know there will be a simple table involved in this too. Here is the table information and query: $infoq = "SELECT * FROM items WHERE itemid='$umiid'"; $info = mysql_query($infoq); while($row = mysql_fetch_array($info)) { $myname = $row['name']; $myid = $row['itemid']; $myimage = $row['image']; $mydesc = $ow['description']; $myrarity = $row['rarity']; echo "$myname<br><img src=/images/items/$myimage>"; } I am wanting to display the "myname" as the name, and the "my image" as the image, underneath the name. Thank you for your help in advance! Quote Link to comment https://forums.phpfreaks.com/topic/266312-how-to-display-data-from-a-mysql-table-in-rows-of-4/ Share on other sites More sharing options...
Barand Posted July 27, 2012 Share Posted July 27, 2012 try reading this other current thread http://forums.phpfreaks.com/index.php?topic=363103.0 Quote Link to comment https://forums.phpfreaks.com/topic/266312-how-to-display-data-from-a-mysql-table-in-rows-of-4/#findComment-1364756 Share on other sites More sharing options...
jazzman1 Posted July 27, 2012 Share Posted July 27, 2012 @off, nice nick dude Quote Link to comment https://forums.phpfreaks.com/topic/266312-how-to-display-data-from-a-mysql-table-in-rows-of-4/#findComment-1364765 Share on other sites More sharing options...
scootstah Posted July 27, 2012 Share Posted July 27, 2012 Something like... $i = 1; while($row = mysql_fetch_array($info)) { $myname = $row['name']; $myid = $row['itemid']; $myimage = $row['image']; $mydesc = $ow['description']; $myrarity = $row['rarity']; echo "<div style=\"float:left;\">$myname<br><img src=/images/items/$myimage></div>"; if ($i % 4 == 0) { echo '<br style="clear:both;" />'; } $i++; } Quote Link to comment https://forums.phpfreaks.com/topic/266312-how-to-display-data-from-a-mysql-table-in-rows-of-4/#findComment-1364770 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.