StanLytle Posted March 20, 2009 Share Posted March 20, 2009 What I'd like to do, is look into a table, to see if a person has had more than x number of rejections (ie: 10), in the past 10 days. I'm not getting anymore mySQL errors, but this just outputs "You can upload pictures" over and over and over again. Any help appreciated. $RejectCutOffTime = strtotime('-10 days'); $query = "SELECT UserID, COUNT(UserID) FROM Rejections WHERE (Date > '$RejectCutOffTime') GROUP BY UserID ORDER BY UserID"; $result = mysql_query($query) or die(mysql_error()); while(list($id, $ct) = mysql_fetch_row($result)) { if (($SessionUserID == $id) AND ($ct > '10')) { print "You have too many rejections to upload pictures"; } else { print "You can upload pictures"; } } Link to comment https://forums.phpfreaks.com/topic/150280-query-doesnt-yield-correct-result/ Share on other sites More sharing options...
redarrow Posted March 20, 2009 Share Posted March 20, 2009 are you sure that the date in the database, is the same format as the strtotime date. Link to comment https://forums.phpfreaks.com/topic/150280-query-doesnt-yield-correct-result/#findComment-789198 Share on other sites More sharing options...
StanLytle Posted March 20, 2009 Author Share Posted March 20, 2009 Yes. With some help (thanks guys) I was able to output (view) the contents of the table by the cutoff time I wanted. See: http://www.phpfreaks.com/forums/index.php/topic,243819.0.html for reference. Now I want to use the data, find a specific person, without displaying the table. Stan Link to comment https://forums.phpfreaks.com/topic/150280-query-doesnt-yield-correct-result/#findComment-789218 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.