Jump to content

[SOLVED] MySQL No results (but there is)


xyn

Recommended Posts

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

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());

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 :P

 

$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 :P its strange

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());

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.