Jump to content

date field mysql is driving me up the wall


Cep

Recommended Posts

Hello,

I have a simple table with a date field, which has 4 records, 2 of which contain the date 2007-01-07

In my sql I have stated,

[code=php:0]
$gsql = "SELECT * FROM cw_games WHERE gamedate = '2007-01-07'";
[/code]

The error I receive is,

Function: get_lastgames
SELECT gsql:
SELECT * FROM cw_games WHERE gamedate = '2007-01-07'
SQL ERROR: Query was empty

This makes no sense to me at all, even the date field type on MySQL's website suggests that the format is always input and output as YYYY-MM-DD so why is my query not picking up the fact that there are two records within the 4 that have the date 2007-01-07 ?
its set to date, I can clearly see the date when I browse the table in phpmyadmin and there are two rows with the date 2007-01-07.

I am literally reading in a string,

$date = "2007-01-07";

$gsql = "SELECT * FROM cw_games WHERE gamedate = '{$date}'";


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.