I am working to build a list of store locations for a given city & state. I'm able to list out all of the locations separately, and I'm able to create a "box" for each location, but I'd like to group all of the store locations together, so you can easily see all of the locations in the same line and "box". In the database each store location is listed in a separate row. Can I do what I want to do using this current database configuration?
I'm new to SQL & PHP - so please explain your solution. 🙂
Thank you so much!
Example:
List of Stores In Washington
Store Name: Big Box Store ABC
Store Locations In Washington: Seattle, Olympia, Northgate, Spokane
Store Website: www.mystore.com
(in future versions i'd like to have the store location name be a link to that locations' website)
Here's what I have so far.
<?php
mysql_select_db("$db_name", $con);
$sql = 'SELECT * FROM allstores
WHERE state_long = "'.$pickstate.'"
ORDER BY storename ';
$result1 = mysql_query($sql);
// Flag variable to track success:
$okay = TRUE;
while($row = mysql_fetch_array($result))
print "<div class ='store-list-box'>
<p><img class='storelogo' src='img/logos/".$row['logoid'] .".jpg' alt='". $row['storename'] ."' />
<span class='storename'>" . $row['storename'] . "</span>
<br />
<strong>Store Locations: </strong>" . $row['city'] . "
<br />
<strong>Store Website: </strong>" . $row['store_url'] . "
</p>
</div>";
mysql_close($con);
?>