Data Mining Coldfusion

Reply

Join Date: Jul 2009
Posts: 8
Reputation: aycmike is an unknown quantity at this point 
Solved Threads: 0
aycmike aycmike is offline Offline
Newbie Poster

Data Mining Coldfusion

 
0
  #1
Jul 23rd, 2009
Im trying to search my database and find out the previous 7 days unique ip addresses. Users ip addresses are stored within the table events under svname. I have a small piece of java that is supposed to count back 6 days.

At the moment its saying there have been 0 unique ip addresses accessing the site within the last 6 days but i know that is wrong!

I know google analyitcs does this much better but im just trying to fix some old sites up, any help would be much appreciatred!

http://newmedia.leeds.ac.uk/ug06/cs0...logs/index.cfm

  1. <!--The Java Function-->
  2. <cfscript>
  3. function myBack(myday)
  4. {
  5. return DateAdd("d", -myday, DateFormat(now(), "MM/DD/YYYY"));
  6. }
  7. </cfscript>
  8.  
  9.  
  10. <!--Query-->
  11. <cfquery name="week_unique_ip" datasource="062909cs06mtr">
  12. SELECT *, IPCount FROM
  13. (
  14. SELECT DISTINCT (svname), COUNT (*) AS IPCount
  15. FROM events
  16. where udate = <cfoutput>'#DateFormat(myBack(6), "DD/MM/YYYY")#'</cfoutput>
  17. GROUP BY svname
  18. )
  19.  
  20. </cfquery>
  21.  
  22. <!--Output-->
  23. <cfoutput>#week_unique_ip.RecordCount#</cfoutput>
Last edited by peter_budo; Jul 24th, 2009 at 2:30 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 60
Reputation: hinde is an unknown quantity at this point 
Solved Threads: 4
hinde hinde is offline Offline
Junior Poster in Training

Re: Data Mining Coldfusion

 
0
  #2
Jul 23rd, 2009
You are checking for event ips that have a udate of EXACTLY 6 days ago, not all events that have occurred since 6 days ago (use > instead of =). You also seem to be querying udate as if its an varchar. Hopefully this isn't the case because I am not sure if the > operator would give you what you want unless you casted all the values or altered your schema. That field should be a datetime.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC