kawai84 Posted November 16, 2008 Share Posted November 16, 2008 hi all... can anyone help me... in this code, i wanna display 'today activities' to user..if the actvity's date=today, then the output will display the activites for today. and if not, it should display 'no activities for today' fyi, the 'else' part didnt work....which is display 'no activities for today'... which part is missing...? thanks.. <?php include ('mysql_connect.php'); $today = (Date("d-m-Y")); $query = "SELECT id, title, date, date2, time, venue, detail, DATE_FORMAT(DATEnow, '%M %d, %Y') as sd FROM events WHERE date='$today'"; $result = @mysql_query($query); if ($result) { echo'<table align="center" border="0" width="95%"> <tr class="newstext"> <td valign="center" align="left" class="newstext">'; while ($row = mysql_fetch_array($result)) { echo '<p><img src="images/handr.gif"> <a href="read_events.php?id='.$row['id'].'"><font size=2 face="verdana"><b> '.$row['title'].'</b></font></a><br>'; } echo'</td</tr></table>'; } else { echo '<font face="verdana" size="2">No activities for today.</font>'; } ?> <link href="style.css" rel="stylesheet" type="text/css" /> Quote Link to comment https://forums.phpfreaks.com/topic/132975-solved-how-to-display-no-activities/ Share on other sites More sharing options...
revraz Posted November 17, 2008 Share Posted November 17, 2008 Do your IF on number of rows returned instead, if it's 0 then its no activities. Quote Link to comment https://forums.phpfreaks.com/topic/132975-solved-how-to-display-no-activities/#findComment-692231 Share on other sites More sharing options...
kawai84 Posted November 23, 2008 Author Share Posted November 23, 2008 thanks for ur help -solved- Quote Link to comment https://forums.phpfreaks.com/topic/132975-solved-how-to-display-no-activities/#findComment-697008 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.