Link to home
Start Free TrialLog in
Avatar of amchugh89
amchugh89

asked on

how can i compare dates in php

i have a javascript table that is populated from a tadabase table called "games" with the following query:

$query1="select * from games";
...and then some inserting into the js table

one of the table columns i have is the game_date.
i want to get it so that games that have already happened are no longer in my js table
i want a query something like:
$query1="select * from games WHERE current_date > game_date";

does my game_date have to be of time type?
does it need to be in a specific format?
is there a php function that gets the current date?
how should i go about comparing these 2 dates - i'm a total n00b
ASKER CERTIFIED SOLUTION
Avatar of gyoreg
gyoreg
Flag of Hungary image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You have posted this question twice. Make sure you look at the answers on both.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If you are using the MySQL DB and game_date field is of date type then try the following query,

SELECT * FROM `games` WHERE game_date >= CURDATE( )
Avatar of Guy Hengel [angelIII / a3]
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.