Hi Frank, I'm not exactly sure what's up with this, I've definitely used something similar before without any problems. However, maybe you can work around it by switching the logic...
if($num) echo "blah, blah, blah"; else echo "There are no events scheduled today!"; Wish I had a better suggestion.. Good luck! Corey Eiseman Infinite Orange Incorporated http://infiniteorange.com/ "Frank Miller" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Thanks to everyone that helped me with my last problem I've run into > another problem and was wondering if someone here could offer any help or > suggestions. The project I'm working on is an event calender. It does > several things but the problem I've run into is when I click a date on the > calendar if there are no events for that day I want to print a message on > the web page saying as much. I've read the documentaion that said if I'm > using a select statement to use mysql_num_rows and that it returns an > integer. Here is a snippet of my code > > $query = "SELECT *,TIME_FORMAT(eventtime, '%l:%i %p')AS eventtime, > DATE_FORMAT(dateofevent,'%M %e, %Y') AS fdateofevent FROM tamutevents > where refid=$refid"; > > $result = mysql_query($query,$connection) or die("Error in Query"); > $num = mysql_num_rows($result); > > > Next I say if ($num == 0) > { > echo " There are no events scheduled today!"; > } > else > { > echo "blah, blah, blah"; > } > > The problem is if there are no records that match the select then it always > goes to the else part. I've tried printing the value of $num and it works > if there is something scheduled but when there is nothing scheduled $num > shows nothing on the screen. > > I'm using Mysql 3.23.38 and php 4.06 on a windows test machine but it works > the same on php 4.06 and Mysql 3.23.46 on my Linux server. > > Has anyone else run into this and if so can you tell me what to do about it. > > Thanks in advance - Frank > > > Frank Miller > Computer Specialist and Webmaster > Technology and Distance Education > Texas A&M University-Texarkana > 2600 North Robison Rd > Texarkana, Texas 75501 > > Phone: 903-223-3156 > Fax: 903-223-3139 > Office: 165 > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php