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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.