Jump to content

help with a join and group


scarhand

Recommended Posts

theres gotta be a way so that this only uses 1 query....im assuming using a join and a group by

 

heres my current code:

 

$sql = mysql_query("select * from `databases` where `id` in (select `id_database` from `categories`)");

while ($row = mysql_fetch_assoc($sql))
{
echo $row['name'] . '<br />';

$sql_c = mysql_query("select * from `categories` where `id_database`='" . $row['id'] . "'");

while ($row_c = mysql_fetch_assoc($sql_c))
{
	echo $row_c['title'] . '<br />';
}
}

Link to comment
https://forums.phpfreaks.com/topic/217817-help-with-a-join-and-group/
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.