and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
hello all
so i have this query.
[syntax="sql"]
SELECT webclient_client, GROUP_CONCAT(webclientsite_sitename SEPARATOR '<br>') as site_name, GROUP_CONCAT(webclientsite_location SEPARATOR '') as site_loc from webclient, webclientsite where webclient_id = webclientsite_webclient_id group by webclientsite_webclient_id order by webclient_client
it works and does everything i need it to do. it groups all the sites that i have by client. the problem is that i want to have the site name be a link to the site. here is the output now:
LRA
Arrow Buick Pontiac GMC
Bloomington Chrysler Jeep
SEV
Sever's Farm Market
Sever's Corn Maze
what is happening is that when i use the group_concat it makes the link look like this.
i would like to have each site name under the clients to be its own link. i kind of remember doing something like that before but i forgot how i did it.
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
select the clients from the client table. using a while loop i loop through them and in side that while loop i make another select statement that selects the sites from another table.
$querywebclient = "SELECT * from webclient order by webclient_client";
$resultwebclient = mysql_query($querywebclient) or die (mysql_error());
$outputwebclient = "";
while ($rowwebclient = mysql_fetch_array($resultwebclient)){
$webclientid = $rowwebclient[webclient_id];
$outputwebclient .="<div>
".$rowwebclient[webclient_client]."</div>";
$querywebclientsite = "SELECT * from webclientsite where webclientsite_webclient_id = $webclientid order by webclientsite_sitename";
$resultwebclientsite = mysql_query($querywebclientsite) or die (mysql_error());
while ($rowwebclientsite = mysql_fetch_array($resultwebclientsite)){
$outputwebclient .= "<div>
<a href='".$rowwebclientsite[webclientsite_location]."'>".$rowwebclientsite[webclientsite_sitename]."</a>
</div>";
}
}
$outputwebclient .= "";
print $outputwebclient;
i am sure that this not the most efficient way of doing things but it works now. i looked thru the links that you had recommended and didnt seem to find what i needed there.