- Impact
- 9
Could really use some help sorting this out..
Have multiple addresses that share the same Gas Station name.. in other words the Gas Station name was entered only once in Mysql.. but Multiple addresses share the Stations name .. Problem is Only One Station is being displayed instead of all Stations on the web pages
So for example if there are 1 Shell Station (brand name) at 3 different address ..only one of them gets displayed..
I think the issue is the part of the coded I turned green ..?
.......
<?php
$querystations = "SELECT * FROM `stations` WHERE `state` = '{$State['id']}' ORDER BY name ASC";
$rowstations = $Db->Rows($querystations);
$resultstations =$Db->Query($querystations);
$querycheck = mysql_query("SELECT * FROM `prices` WHERE approved = '0' and archive != '0'");
while($checkrow = mysql_fetch_array($querycheck)) {
$ids .= str_replace('ID:', '', $checkrow['station'] .',');
}
$station_array = explode(',', trim($ids));
for($i = 0; $i < $rowstations; $i++){
$station_id = trim($Db->Result($resultstations, $i, 'id'));
$station_name = $Db->Result($resultstations, $i, 'name');
$station_cityid = $Db->Result($resultstations, $i, 'city');
if(array_search($station_id, $station_array) === FALSE)
{
$querycity = "SELECT * FROM `citys` WHERE `id` = '{$station_cityid}'";
$station_city = $Db->FetchArray($querycity);
$queryaddress = "SELECT * FROM `address` WHERE `station` = '". $Db->Result($resultstations, $i, 'id') . "'";
$station_addr = $Db->FetchArray($queryaddress);
?><tr align="center">
<td><?php echo stripslashes($station_name) ?></td>
<td><?php echo "<a href=\"./{$State['state']}/{$station_city['name_short']}.html\">{$station_city['name']}</a>";?></td>
<td><?php echo "<a href=\"http://maps.google.com/?q={$State['state']}, {$station_city['name']}, {$station_addr['name']}\">{$station_addr['name']}</a>"; ?></td>
<td>
---------- Post added at 04:39 PM ---------- Previous post was at 04:36 PM ----------
Or maybe here..
$querystations = "SELECT * FROM `stations` WHERE `state` = '{$State['id']}' ORDER BY name ASC";
$rowstations = $Db->Rows($querystations);
$resultstations =$Db->Query($querystations);
maybe it needs to query not only station names but the different addreses also in that part of the code? maybe a "JOIN" statement or something ?
I know just enough to screw it it royaly
Have multiple addresses that share the same Gas Station name.. in other words the Gas Station name was entered only once in Mysql.. but Multiple addresses share the Stations name .. Problem is Only One Station is being displayed instead of all Stations on the web pages
So for example if there are 1 Shell Station (brand name) at 3 different address ..only one of them gets displayed..
I think the issue is the part of the coded I turned green ..?
.......
<?php
$querystations = "SELECT * FROM `stations` WHERE `state` = '{$State['id']}' ORDER BY name ASC";
$rowstations = $Db->Rows($querystations);
$resultstations =$Db->Query($querystations);
$querycheck = mysql_query("SELECT * FROM `prices` WHERE approved = '0' and archive != '0'");
while($checkrow = mysql_fetch_array($querycheck)) {
$ids .= str_replace('ID:', '', $checkrow['station'] .',');
}
$station_array = explode(',', trim($ids));
for($i = 0; $i < $rowstations; $i++){
$station_id = trim($Db->Result($resultstations, $i, 'id'));
$station_name = $Db->Result($resultstations, $i, 'name');
$station_cityid = $Db->Result($resultstations, $i, 'city');
if(array_search($station_id, $station_array) === FALSE)
{
$querycity = "SELECT * FROM `citys` WHERE `id` = '{$station_cityid}'";
$station_city = $Db->FetchArray($querycity);
$queryaddress = "SELECT * FROM `address` WHERE `station` = '". $Db->Result($resultstations, $i, 'id') . "'";
$station_addr = $Db->FetchArray($queryaddress);
?><tr align="center">
<td><?php echo stripslashes($station_name) ?></td>
<td><?php echo "<a href=\"./{$State['state']}/{$station_city['name_short']}.html\">{$station_city['name']}</a>";?></td>
<td><?php echo "<a href=\"http://maps.google.com/?q={$State['state']}, {$station_city['name']}, {$station_addr['name']}\">{$station_addr['name']}</a>"; ?></td>
<td>
---------- Post added at 04:39 PM ---------- Previous post was at 04:36 PM ----------
Or maybe here..
$querystations = "SELECT * FROM `stations` WHERE `state` = '{$State['id']}' ORDER BY name ASC";
$rowstations = $Db->Rows($querystations);
$resultstations =$Db->Query($querystations);
maybe it needs to query not only station names but the different addreses also in that part of the code? maybe a "JOIN" statement or something ?
I know just enough to screw it it royaly







