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

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  ";

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

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.