homepage Welcome to WebmasterWorld Guest from 54.211.14.159
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
How to display 2 items connected
to one product
dauction

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3913049 posted 11:27 pm on May 13, 2009 (gmt 0)

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

"<?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>

 

coopster

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



 
Msg#: 3913049 posted 1:28 pm on May 21, 2009 (gmt 0)

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved