|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I'm using cookies to customize an index page once a user has created an account and I have a last_visited DATETIME variable in a user table that I want to update every time the user visits the site. I set
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre> $new_last_visited = $new_last_visited = date("m-d-Y H:i:s", (time())); [/code] Then I send a query like so to update the date. <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre> $query = "UPDATE account SET last_visited='$new_last_visited' WHERE ID=$user_id"; [/code] well... it sets the date to 0000-00-00 00:00:00 and I have no clue why. Please help!! |
|
#2
|
|||
|
|||
|
try without the '-sign. I've had the same problem myself.
$query = "UPDATE account SET last_visited=$new_last_visited WHERE ID=$user_id"; |
|
#3
|
|||
|
|||
|
zreo,
I've tried it without the ' and it doesn't work. I've tried the following: <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre> set last_visited='$new_last_visited' set last_visited=$new_last_visited set last_visited="$new_last_visited" [/code] nothing works. it still updates it to 0000-00-00 00:00:00 Does anyone have a solution?? Thanks |
|
#4
|
|||
|
|||
|
Hi @vantageIT,
are you sure your query-string is correct? Add the following to your script<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>echo $query;[/code]If the query is correct, check to see if the mysql-account you use is allowed to do updates! Bye, Marc aka Foddex ------------------ ++++++++++++++++++++++++++++++++++++++++ ceterum censeo linguam c++ esse delendam |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > PHP Development > Problems with UPDATE in a PHP script- |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|