xyn Posted August 21, 2007 Share Posted August 21, 2007 Ok, I've been pulling my hair out of this one, basically I have a query which will match if a deadline date is reached or past. and basically if i use PHP I can get the queries correctly. But because of the pagination scripts i'm running I need it to work in mysql... Heres my query: $result = mysql_query("SELECT * FROM `intranet_accounts_tickets` WHERE `recipients_account_id`='".$_SESSION['intranet_user_id']."' AND `ticket_closed`='0' AND `ticket_deleted`='0' /*AND `ticket_deadline_date` < '".date("j/m/Y, H:i:s")."'*/ ORDER BY `ticket_deadline_date` DESC LIMIT $limitvalue, $limit"); Link to comment https://forums.phpfreaks.com/topic/65965-solved-mysql-no-results-but-there-is/ Share on other sites More sharing options...
MadTechie Posted August 21, 2007 Share Posted August 21, 2007 remove the comment if you have a php var in their!! $result = mysql_query("SELECT * FROM `intranet_accounts_tickets` WHERE `recipients_account_id`='".$_SESSION['intranet_user_id']."' AND `ticket_closed`='0' AND `ticket_deleted`='0' ORDER BY `ticket_deadline_date` DESC LIMIT $limitvalue, $limit") or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/65965-solved-mysql-no-results-but-there-is/#findComment-329818 Share on other sites More sharing options...
pranav_kavi Posted August 21, 2007 Share Posted August 21, 2007 pls post the section of the db code. Link to comment https://forums.phpfreaks.com/topic/65965-solved-mysql-no-results-but-there-is/#findComment-329819 Share on other sites More sharing options...
xyn Posted August 21, 2007 Author Share Posted August 21, 2007 sorry if you ignore the comments. i still get an error; the comment was part of my debug to locate where th problem is hense i know its my syntax $result = mysql_query("SELECT * FROM `intranet_accounts_tickets` WHERE `recipients_account_id`='".$_SESSION['intranet_user_id']."' AND `ticket_closed`='0' AND `ticket_deleted`='0' AND `ticket_deadline_date` < '".date("j/m/Y, H:i:s")."' ORDER BY `ticket_deadline_date` DESC LIMIT $limitvalue, $limit"); and i know there is 1 record which should be displayed as i changed the date its strange Link to comment https://forums.phpfreaks.com/topic/65965-solved-mysql-no-results-but-there-is/#findComment-329826 Share on other sites More sharing options...
MadTechie Posted August 21, 2007 Share Posted August 21, 2007 change to this $result = mysql_query("SELECT * FROM `intranet_accounts_tickets` WHERE `recipients_account_id`='".$_SESSION['intranet_user_id']."' AND `ticket_closed`='0' AND `ticket_deleted`='0' AND `ticket_deadline_date` < '".date("j/m/Y, H:i:s")."' ORDER BY `ticket_deadline_date` DESC LIMIT $limitvalue, $limit") or die(mysql_error()); and post the error is any! if the ticket_deadline_date is a date field try $result = mysql_query("SELECT * FROM `intranet_accounts_tickets` WHERE `recipients_account_id`='".$_SESSION['intranet_user_id']."' AND `ticket_closed`='0' AND `ticket_deleted`='0' AND `ticket_deadline_date` < Now() ORDER BY `ticket_deadline_date` DESC LIMIT $limitvalue, $limit") or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/65965-solved-mysql-no-results-but-there-is/#findComment-329830 Share on other sites More sharing options...
xyn Posted August 21, 2007 Author Share Posted August 21, 2007 There is no error. the problem is if i make an array get the times do an if statement la de da i can match them to do what i want However this means i cant use my pagination script. So i want to know why i can use greater than fields in my sql and it works.. but hwne itry using it with the date it wont. + there is no syntax error so mysql_error() is useless. Link to comment https://forums.phpfreaks.com/topic/65965-solved-mysql-no-results-but-there-is/#findComment-329835 Share on other sites More sharing options...
MadTechie Posted August 21, 2007 Share Posted August 21, 2007 if `ticket_deadline_date` is a timestamp then you could use blarr blarr "`ticket_deadline_date` < ".time()+(24*60*60)." order blarr blarr Link to comment https://forums.phpfreaks.com/topic/65965-solved-mysql-no-results-but-there-is/#findComment-329841 Share on other sites More sharing options...
xyn Posted August 21, 2007 Author Share Posted August 21, 2007 i fixed it. i basically changed the date formats and used to_days(now()) Link to comment https://forums.phpfreaks.com/topic/65965-solved-mysql-no-results-but-there-is/#findComment-329863 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.