> I have a login that I want to capture user stats with. However, I am
> having trouble identifing the QUERY INSERT with the UPDATE. In this
> case I am attempting to identify the userID and pass it to the Update.
> This is probably not the best method - any suggestions.
>

<CFQUERY NAME="getID">
SELECT MAX(UID)+1
FROM trackusers
WHERE UID != ''
</cfquery>
<cfset This_ID="<cfoutput query="getID">##</cfoutput>">

<CFQUERY NAME="login">
SELECT   *
FROM users
Where  username = '#username#' and pwd = '#pwd#'
</cfquery>

<cfset passed="indexblog.cfm">
<cfset failed="failed.cfm">
<cfset login_datetime = createODBCDateTime(now())>
<cfoutput query="login">
<cfif login.logincount is not "0">

<CFINSERT TABLENAME="trackusers" FORMFIELDS="username, pwd ">

<cfquery>
  UPDATE trackusers
  SET Logindate=#login_datetime#, IP='#remote_addr#', browser='#http_user_agent#', remote_host='#remote_host#', remote_referer='#http_referer#'
  WHERE userID = #This_id#
  </cfquery>


<cflocation url="" addtoken="No">
<cfelse>
<cflocation url="" addtoken="No">
</cfif>
<cfif login.recordcount is "0">
<cflocation url="" addtoken="No">
<cfelse>
</cfif>
</cfoutput>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to