Reply to Re: PHP help with if else

Your name:

Reply:


Posted by Steve on 08/27/07 16:52

>
> You didn't show us your SELECT statement, but if it doesn't return any
> rows, your mysql_fetch_array() call will return false - and not execute
> anything in the loop.
>
>

Here it is with the select statement. The statement DOES work, because if
there are listings in the DB they will display correctly. It's just the
if...else portion of the code that i can not get to execute.

$sql = "select ID, date, venue, street, city, state, time, cost, notes from
tblBand order by date";
$result = mysql_query($sql);


while($band = mysql_fetch_array($result, MYSQL_ASSOC))
{
$change_to_time = strtotime($band[date]);
$newdate = date('m.d.Y', $change_to_time);


if (empty($band[date])) {
echo "No shows on the calendar.";
}

else {
echo "<div id=\"line1\">$newdate - $band[venue]</div>";
echo "<div id=\"line2\">$band[street] $band[city], $band[state] - <a
href =
\"http://maps.google.com/maps?q=$band[street]+$band[city]+$band[state]\">Map</
a></div>";
echo "<div id=\"line3\">$band[notes]</div>";
echo "<div id=\"line4\">Time - $band[time], Cost - $band[cost]</div>";
echo "<hr />";
}
}

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация