DeanWhitehouse Posted May 19, 2008 Share Posted May 19, 2008 How can i have it so that my page looks like this catergory1 | catergory2 | catergory3 imagefromcat1|imagefromcat2|imagefromcat3 i already it on the correct rows, etc. but it shows catergory1 | catergory1 | catergory1 imagefromcat1|imagefromcat1|imagefromcat1 this is my code <?php $query = "SELECT image_id, image_name, image_link, folder_name,img_time FROM `darkflame_gallery`"; $result = mysql_query($query) or die("Error:" . mysql_error()); $qery = "SELECT catergory FROM `darkflame_catergory`"; $rsult = mysql_query($qery) or die("Error:" . mysql_error()); $s = mysql_fetch_assoc($rsult); $sql = "SELECT * FROM darkflame_gallery WHERE `folder_name`='{$cate}' ORDER BY RAND() LIMIT 1"; $reslt = mysql_query($sql) or die ("Error:" . mysql_error()); $rw = mysql_fetch_assoc($reslt); $cate = $row['folder_name']; $i = 0; ?> <table><tr> <?php while ($row = mysql_fetch_assoc($result)) { if ($i == 4) { $i = 0; // reset variable echo "<tr>"; // break the line } ?><td><?php echo $s['catergory'] ?><br><a href="?image_cat=<?php echo $row['catergoy']; ?>"><img width="200px" src="<?php echo $rw['image_link']; ?>"></a> <?php $i++; // increase $i each time through the loop } ?> </td></tr></table> Quote Link to comment https://forums.phpfreaks.com/topic/106350-solved-how-can-i-do-this-mysql-question/ Share on other sites More sharing options...
DarkWater Posted May 19, 2008 Share Posted May 19, 2008 It's spelled "category". Quote Link to comment https://forums.phpfreaks.com/topic/106350-solved-how-can-i-do-this-mysql-question/#findComment-545111 Share on other sites More sharing options...
DeanWhitehouse Posted May 19, 2008 Author Share Posted May 19, 2008 lol, yer soz, i didn't check it, but my table is called that Quote Link to comment https://forums.phpfreaks.com/topic/106350-solved-how-can-i-do-this-mysql-question/#findComment-545120 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.