PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 15th, 2000, 03:58 PM
@vantageIT @vantageIT is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2000
Location: St. Louis, Missouri, USA
Posts: 2 @vantageIT User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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!!

Reply With Quote
  #2  
Old February 15th, 2000, 06:14 PM
zreo zreo is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2000
Location: Malmö
Posts: 13 zreo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to zreo
try without the '-sign. I've had the same problem myself.

$query = "UPDATE account SET last_visited=$new_last_visited WHERE ID=$user_id";

Reply With Quote
  #3  
Old February 15th, 2000, 08:06 PM
@vantageIT @vantageIT is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2000
Location: St. Louis, Missouri, USA
Posts: 2 @vantageIT User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #4  
Old February 16th, 2000, 04:57 AM
Foddex Foddex is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2000
Posts: 9 Foddex User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Problems with UPDATE in a PHP script-


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT