Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

How to display 2 items connected

to one product



11:27 pm on May 13, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

Works fine but if addresses share the same Station name only the first Station actually displays instead of both Stations..appreciate any help to lead me in the right direction

$querystations = "SELECT * FROM `stations` WHERE `state` = '{$State['id']}' ORDER BY name ASC";
$rowstations = $Db->Rows($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>


1:28 pm on May 21, 2009 (gmt 0)

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

I believe this is your issue:
if(array_search($station_id, $station_array) === FALSE)

It seems like you are likely finding your station already in the array and therefore not processing it a second time.

Featured Threads

Hot Threads This Week

Hot Threads This Month