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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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