Re: Issue with date() function...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



need the quotes around the date

$sql = "UPDATE $table1 SET last_access_date='$rec2day' WHERE
username='$dealer_number' AND password='$password'";


bastien

From: "Chase" <php@xxxxxxxxxxxx>
To: php-db@xxxxxxxxxxxxx
Subject: Re:  Issue with date() function...
Date: Fri, 10 Jun 2005 10:52:16 -0600

I made that modification and now it doesn't update the DB at all...

Here is the code that I am using to insert that variable into my MySQL DB...
Again, my variable is defined as $rec2day = date("Y-m-d") OR $rec2day =
date("Y/m/d")



<?php

$connection = @mysql_connect("$server", "$user", "$pass") or die("Couldn't
Connect To Server.");

$db = @mysql_select_db($dbname, $connection) or die("Couldn't Select
Database.");

$sql = "UPDATE $table1 SET last_access_date=$rec2day WHERE
username='$dealer_number' AND password='$password'";

$result = @mysql_query($sql,$connection) or die("Couldn't Execute Query.");

?>







"Bruno Ferreira" <morphine@xxxxxxxxxxxxxxxx> wrote in message
news:42A9BA9F.4050406@xxxxxxxxxxxxxxxxxxx
> Chase wrote:
>
>>I have a variable:
>>    $rec2day = date("Y-m-d");
>>that displays correctly when echoed to the screen, but when I write it to
>>my DB, I get the mathmatical answer to the equasion (1989 (2005-06-10)).
>>
>>What do I need to do to correct this??
>>
>    Just use $rec2day= date("Y/m/d");
>
>    You database system doesn't like using "-" as a separator in dates,
> thus thinking it's a minus sign and doing the appropriate math. Just use
> slashes and you'll probably be OK.
>
>    -- Bruno Ferreira
> ---
> [This E-mail scanned for viruses by Declude Virus]

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux