Is it possible to use 1 query instead 2? Or this way is better? (for speed)
<?
$q1 = mysql_query("SELECT name,url,id FROM gallery") or die(mysql_error());
if (mysql_num_rows($q1) > 0) {
while ($row = mysql_fetch_array($q1)) {
echo 'IMAGES FROM '.$row['name'];
$id = $row['id'];
//second query for each gallery
$imgq = mysql_query("SELECT img FROM img WHERE ids=" . $id . " ") or die(mysql_error());
while ($img = mysql_fetch_array($imgq)) {
?><img src="<?=$img['img'];?>"><?
} //multiple images
}
}