Hi all,
I have the following loops that work as expected:
$firstQuery = " SELECT bgroup.group FROM bgroup";
$firstResult = mysql_query ( $firstQuery ) or die ( mysql_error() );
while( $firstRow = mysql_fetch_array( $firstResult )) {
echo "<h2>". $firstRow['group']." </h2><br />";
$query = " SELECT bmarks.name, bmarks.group, bmarks.address FROM bmarks LEFT JOIN ( bgroup) ON (bgroup.group = '".$firstRow['group']."' ) WHERE bmarks.group = bgroup.group ORDER BY bgroup.group";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
echo "<a href=\"" .$row['address'] ."\" target=\"_blank\">". $row["name"]. "</a>";
echo "<br />";
}
}
But I am a much better way to do this rather than having to query the database everytime the first loop kicks in. I have a small database at the moment but I cant imagine how much overload it would be with couple of hundred of items in the DB.
My DB consists of 2 tables
bmarks table contains all the bookmarks (address/description/info)
bgroup table contains a list of groups that beling to the bmark table
Thanks