Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Another dateformat update problem..

Status
Not open for further replies.

kelani

MIS
Nov 29, 2000
44
US
Simply,

When a user logs in, I want their "Last Login" to update to the current date. By using previous threads examples, I have he following query

<cfset CurrentDate = DateFormat(Now(), &quot;yyyy/mm/dd&quot;)>

<cfquery name=&quot;db_insert&quot; datasource=&quot;dbname&quot; dbtype=&quot;ODBC&quot; username=&quot;username&quot; password=&quot;pswd&quot; dbserver=&quot;localhost&quot; dbname=&quot;dbname&quot;>
UPDATE users SET last=#CurrentDate# where id=#id#
</cfquery>

last = the date (no time) field in

When a user logs in, it properly shows the current date as the last login, but if you refresh this, that user's last login has become 0000-00-00, and it returns an error.

Guessing CreateODBCDate needs to be here somewhere? Didn't in previous examples, but then again.. :)



 
I would just change the update query and set last=#CreateODBCDate(Now())#. I've had very mixed results when I wasn't using the CreateODBCDate function. I have not had a single problem since I started using it. Andrew
amayer@sonic.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top