View Single Post
Old May 17th, 2004, 4:30 PM   #3
Pizentios
Programming Guru
 
Pizentios's Avatar
 
Join Date: May 2004
Location: Brandon, Manitoba, Canada
Posts: 2,023
Rep Power: 7 Pizentios is on a distinguished road
Send a message via ICQ to Pizentios Send a message via MSN to Pizentios
As fars as i can tell, big_k105 is right.

Quote:

$output = "<table border=1>\n";
if (mysql_num_rows($data) == 0) { // in the case of no results found - display alert message
$output .= "<tr><td colspan=3>No results found</td></tr>";

} else {
forEach ($agencies as $agency) { // display row for each result (eg. you can have more agencies in one town)
$output .= "<tr>";
$output .= "<td>".$agency["date"]."</td>";
$output .= "<td>".$agency["agency"]."</td>";
$output .= "<td>".$agency["city"]."</td>";

$output .= "</tr>\n";
}
}

$output .= "</table>\n";

echo $output;
the problem is where you are outputing your data, the only fields that are being outputed are date, agency and city because those are the on;y ones that you are telling it to output. Anyways, here's how i would do it:

echo "<table border=1>";
if (mysql_num_rows($data) <> 0)
{
     forEach ($agencies as $agency)
     {
           echo "<tr>";
           echo "<td>{$agency['date']}</td>";
           echo "<td>{$agency['agency']}</td>";
           echo "<td>{$agency['city']}</td>";
           echo "<td>{$agency['day']}</td>";
           echo "<td>{$agency['time']}</td>";
           echo "<td>{$agency['location']}</td>";
           echo "<td>{$agency['building_room']}</td>";
           echo "<td>{$agency['street']}</td>";
           echo "<td>{$agency['zip']}</td>";
           echo "<td>{$agency['phone']}</td>";
           echo "<td>{$agency['contact']}</td>";
           echo "</tr>";
      }
}
else
{
      echo "<tr>";
      echo "<td>No Results Found!</td>";
      echo "</tr>";
}

echo "</table>";

But that's just how i would do it. I find this way a little easyer to read, thus making it easyer to debug. Post any questions that you have and i am sure we can get this problem fixed. Happy Codding!

-Pizentios
__________________
Profanity is the one language that all programmers understand.

Check out my Blog <---updated Nov 30 2007!
Pizentios is offline   Reply With Quote