Here's the thing. I'm trying to update a record when a user logs in. I have a login script that I am trying to have automatically update a record upon login. I figure the easiest way to do it is have the page submitted to another page which updated the record's last access date and then redircts to the actual page they are going to.
This however does not work I am getting a Parse error. ---------- Original Message ----------- From: Marco Tabini <[EMAIL PROTECTED]> To: vernon <[EMAIL PROTECTED]> Sent: 13 Nov 2002 17:18:18 -0500 Subject: Re: [PHP] UPDATE MySQL > I can see two things that are not correct in the statement: > > First, the date you're setting is in UNIX format--but MySQL wont' > like that. You need to use FROM_UNIXTIME. > > Second, the username is a string (I guess), but it's not within > quotation marks. > > $myquery = "UPDATE penpals SET > lastaccess=FROM_UNIXTIME($lastaccessdate) WHERE ID='$myuserid'"; > > Two notes: > > The MySQL extension does not normally print out errors. You need to > explicity call mysql_error() to do that. In this case, you can add it > after the call to mysql_query(), e.g.: > > die (mysql_error()); > > Also, you are passing HTTP data directly to MySQL. This can allow a > malicious user to insert potentially "evil" code in your call and cause > all sorts of damage. I suggest you consider filtering that > information using one of the many methods available. > > Marco > > -- > ------------ > php|architect - The magazine for PHP Professionals > The first monthly worldwide magazine dedicated to PHP programmers > > Come visit us at http://www.phparch.com! ------- End of Original Message ------- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php