phpbar.de logo

Mailinglisten-Archive

[php] MySQL Update Timestamp- Feld

[php] MySQL Update Timestamp- Feld

Michael Wallner php_(at)_phpcenter.de
Sat, 10 Aug 2002 17:23:20 +0200


Ralf Eggert und Michael Post schrieben:
> $update  = $db->query("UPDATE users SET lastlogin=" . now() . " WHERE
>                        kundennr='$loginname';");
> 

NOW() ist eine MySQL-Function und keine PHP-Function ;)


aus dem Manual:
<QUOTE>
The TIMESTAMP column type provides a type that you can use 
to automatically mark INSERT or UPDATE operations with the 
current date and time. If you have multiple TIMESTAMP 
columns, only the first one is updated automatically.

Automatic updating of the first TIMESTAMP column occurs 
under any of the following conditions:

The column is not specified explicitly in an INSERT or LOAD 
DATA INFILE statement.
The column is not specified explicitly in an UPDATE 
statement and some other column changes value. (Note that an 
UPDATE that sets a column to the value it already has will 
not cause the TIMESTAMP column to be updated, because if you 
set a column to its current value, MySQL ignores the update 
for efficiency.)
You explicitly set the TIMESTAMP column to NULL.
TIMESTAMP columns other than the first may also be set to 
the current date and time. Just set the column to NULL or to 
NOW().

</QUOTE>

HTH,
Michael


php::bar PHP Wiki   -   Listenarchive