[SOLVED] MySQL dates - checking less than more than a date i

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

mjseaden
Forum Contributor
Posts: 458
Joined: Wed Mar 17, 2004 5:49 am

Post by mjseaden »

You can access my database? Here's the code:

Code: Select all

$query = 'SELECT UNIX_TIMESTAMP(''CustomerViewFrom'') CustomerViewFrom FROM Customers';
$result = mysql_query($query);

if(!$result)
{
    do_html_message('Error performing MySQL query - '.mysql_error());
    do_html_footer();
    exit();
}

$row = mysql_fetch_array($result);
echo $row['CustomerViewFrom'];
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

ok.. it's because you have single quotes, not backticks..copy this exactly, for that line:

Code: Select all

$query = "SELECT UNIX_TIMESTAMP( `CustomerViewFrom` ) `CustomerViewFrom` FROM `Customers`";
mjseaden
Forum Contributor
Posts: 458
Joined: Wed Mar 17, 2004 5:49 am

Post by mjseaden »

Hi feyd,

Thanks very much - really appreciate the help. I'm now getting the same output as yourself.

Cheers,

Mark
Post Reply