I've upgraded my stats tool quite a bit.  One thing that I'm seeing that
is VERY cool about storing the stats in the database is being able to
store a #client.user_id# (i.e. a primary key to a logged in user's
record).

Get this.... I have two scheduled tasks, one that dumps the application
scoped query to the database, and a second that runs this code:

<cfquery name="nonnull" datasource="#request.logdsn#">
        select distinct user_id,token
                from page_logs
                        where user_id is not null
                        and token in (select distinct token from page_logs where 
user_id is
null)
</cfquery>

<cfloop query="nonnull">
        <cfquery name="updatenull" datasource="#request.logdsn#">
                update page_logs
                        set user_id=#user_id#
                        where token='#token#'
                        and user_id is null
        </cfquery>
</cfloop>

Basically this code does this:

Page                            User_id         token
/index.cfm?fuseaction=1         NULL            11202:383839
/index.cfm?fuseaction=2         NULL            11202:383839
/index.cfm?fuseaction=3         205             11202:383839

And changes it to this:

Page                            User_id         token
/index.cfm?fuseaction=1         205             11202:383839
/index.cfm?fuseaction=2         205             11202:383839
/index.cfm?fuseaction=3         205             11202:383839

User_id is the foreign key to my "users" table, so now I can view the
trail of individual users.  This has about a zillion and one uses.

Steve Nelson
Online Web Development Training:
http://www.SecretAgents.com/training
(804) 825-6093

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to