Sign in to follow this  
bender

help selecting a period of time

Recommended Posts

Hi again everyone..

 

 

 

I want the users of my website to be able to select data for the graph to display only 1 year, 3 years or 5 years. So I went to select the date using date() and strtotime function in php...

 

 

 

I tested it with my database by selecting this month's data, but it says 'No Data To Display'. I don't know what is wrong...can you help me?

 

 

 

My codes is in attachment.. thanks in advance!

testing.txt

Edited by Guest

Share this post


Link to post
Share on other sites

Hi,

 Could you please change date format to m/d/Y format for Access? Please change it to

  $skrg = date('m/d/Y', strtotime('now'));

  $tarikh = date('m/d/Y', strtotime('1 august 2008'));

$strQuery = "SELECT Date, Column1, Column2 FROM [Testing] WHERE Date='$skrg' AND Date>='$tarikh' ORDER BY Date";

Edited by Guest

Share this post


Link to post
Share on other sites

hi,

could you please print $strQuery and after that please run this query into MS Access query and see the query result. also check date with in 'date'???

$strQuery = "SELECT Date, Column1, Column2 FROM [Testing] WHERE Date between '$tarikh' AND '$skrg' ORDER BY Date";

Edited by Guest

Share this post


Link to post
Share on other sites

thanks Arindam..

 

 

 

I checked the query of selecting the dates in Access and copied them into my code and it worked well...thanks again for helping me :D

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this