Can I LIMIT 1 for one specific column but not the rest? I have two tables. One with info and one with images. For as many images there are, that many info queries are run. So, it will be 5 images and 5 of the same title. How can I LIMIT 1 title, and LIMIT 3 images?
$query = mysql_query("
SELECT `$category`.title AS title,
page_images.image_loc AS images
FROM `$category`, page_images
WHERE `$category`.title = page_images.title
");
while($fetch = mysql_fetch_assoc($query)) {
$title = $fetch['title'];
$images = $fetch['images'];
echo '<b>'.$title.'</b><br />';
echo '<a href="http://localhost/'.$images.'">
<img src="http://localhost/'.$images.'" height="80" width="80" />
</a>';
}
you can group by title and collect image locations using GROUP_CONCAT. and then you can explode the collected locations to an array. and print all the images.
here what i mean