CloudSex13 Posted March 14, 2009 Share Posted March 14, 2009 Hey there - For some reason, either I'm missing something in my code or I'm using a variable the wrong way, but it seems to return nothing back when echoing the results. What I'm trying to accomplish is, to get all fields pertaining to a user's ID from the database, then match today's date with the deadline date in the database, and display the amount of results as a number. My code is below: $tasks = mysql_query("SELECT Deadline FROM Tasks WHERE AccountID='$AccountID' AND Status='1'"); while($gettasks = mysql_fetch_array($tasks)) { $Deadline = $gettasks['Deadline']; $altdate = date("Y-m-d"); while($altdate == $Deadline) { $amountoftasks = mysql_num_rows($tasks); $taskstoday = $amountoftasks + 1; } } Anything help would be heavenly - I'm simply baffled, as for I am a self-taught PHP coder. Thank you if so. Link to comment https://forums.phpfreaks.com/topic/149348-solved-match-todays-date-with-date-in-database-and-display-amount-of-results/ Share on other sites More sharing options...
Festy Posted March 14, 2009 Share Posted March 14, 2009 Use if instead of while in the following code: By the way, where exactly are you displaying the results ? while($altdate == $Deadline) { $amountoftasks = mysql_num_rows($tasks); $taskstoday = $amountoftasks + 1; } Link to comment https://forums.phpfreaks.com/topic/149348-solved-match-todays-date-with-date-in-database-and-display-amount-of-results/#findComment-784410 Share on other sites More sharing options...
CloudSex13 Posted March 14, 2009 Author Share Posted March 14, 2009 Fixed it myself - thanks for the assistance Festy! Link to comment https://forums.phpfreaks.com/topic/149348-solved-match-todays-date-with-date-in-database-and-display-amount-of-results/#findComment-784794 Share on other sites More sharing options...
Festy Posted March 15, 2009 Share Posted March 15, 2009 Fixed it myself - thanks for the assistance Festy! You're welcome. Please also post how the problem was fixed everytime in the forum. Link to comment https://forums.phpfreaks.com/topic/149348-solved-match-todays-date-with-date-in-database-and-display-amount-of-results/#findComment-785167 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.