Jump to content

[SOLVED] how can i do this!!! mysql question


DeanWhitehouse

Recommended Posts

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>

 

Link to comment
https://forums.phpfreaks.com/topic/106350-solved-how-can-i-do-this-mysql-question/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.