Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

Querying between dates via a web app.

Codes here !

Moderators: macek, egami, gesf

Querying between dates via a web app.

Postby Nico » Mon Aug 12, 2002 9:06 am

I'm quite new to the php/mysql area but I like it :) I can do basic tables in mysql and queries via php. I'm trying to move on and need some assistance. I'm trying to write a query in php to get a date range from the mysql table. The user will input two dates via a webpage to search the database. (i.e. I input 07/10/2002 and 08/10/2002 to serach for all records created on and between those dates) I have tried a few different ways to do this, however none have been successful. Please help me out! Your help is VERY much appreciated!


Nico
8O
Nico
New php-forum User
New php-forum User
 
Posts: 4
Joined: Mon Aug 12, 2002 8:52 am

Postby fresiafunk » Mon Aug 12, 2002 9:40 am

You try Select * from table where date BETWEEN 'date1' AND 'date2' ??? :roll:
User avatar
fresiafunk
New php-forum User
New php-forum User
 
Posts: 8
Joined: Mon Aug 12, 2002 5:17 am
Location: CHILE - SOUTH AMERIKA - Land of Dreams and Girls

Yep sure did

Postby Nico » Mon Aug 12, 2002 10:06 am

Its certainly quite possible that i'm writing the php stuff incorrectly tho... I made the text fields date1 and date2 so I use BETWEEN '$date1' AND '$date2'

I know that typing that into the command line works, but i can't get it from webpage to query back to webpage.

Sorry I should have been more specific-- I know the BETWEEN works, but my php is quite poor

Nico
Nico
New php-forum User
New php-forum User
 
Posts: 4
Joined: Mon Aug 12, 2002 8:52 am

Erm... nevermind... found the problem...

Postby Nico » Mon Aug 12, 2002 12:17 pm

<cough cough> syntax
Nico
New php-forum User
New php-forum User
 
Posts: 4
Joined: Mon Aug 12, 2002 8:52 am

Postby Jay » Mon Aug 12, 2002 2:08 pm

Make sure you're querying the date in the same format as you're storing them!
Jay
 


Return to mySQL & php coding

Who is online

Users browsing this forum: Google [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron