Jump to content

[SOLVED] making a selection of between and including of dates


Poddy

Recommended Posts

i have this code:

$sql = "select * from `data`  where  `name` LIKE '$name' AND `spot` LIKE '$line' AND `piret` LIKE '$piret' AND `timestamp` BETWEEN '$before' AND '$after' ORDER BY `timestamp` DESC  ";

it works fine, the problem is if i select from dates like 2008-06-11 to 2008-06-25 i get all dates between them, but those with 25 i do not get..

is there any way to get around this? thanks

Link to comment
Share on other sites

I would personally use >= <= rather than between, so something like:

 

$sql = "select * from `data`  where  `name` LIKE '$name' AND `spot` LIKE '$line' AND `piret` LIKE '$piret' AND `timestamp` >= '$before' AND `timestamp` <= '$after' ORDER BY `timestamp` DESC  ";

Link to comment
Share on other sites

thanks for the reply but it still dosent display the last day

 

query:

select * from `data` WHERE `timestamp` >= '2008-06-15' AND `timestamp` <= '2008-06-25' ORDER BY `timestamp` DESC

 

result:

  	Edit   	Delete   	101  	4  	fghf  	456  	fghfg  	1  	2008-06-24 17:09:10  	5  	5  	5
Edit 	Delete 	96 	5 	sdfds 	324 	dfgdf 	1 	2008-06-15 17:08:12 	5 	5 	5

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.