If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Re:Inserting and displaying Unique Statistics from users viewing my site, problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-06-04, 18:20
bearslife bearslife is offline
Registered User
 
Join Date: May 2004
Posts: 2
Exclamation Re:Inserting and displaying Unique Statistics from users viewing my site, problem

I am trying to figure out how I can insert user information only once
(ip,date,browser,referrer) etc... I don't want to have the user information inserted more than once into my mysql database table. Then I want to display it only once every visitor. I have the scripts working fine right now, but it enters and displays every hit to my site regardless if it is unique or not.
My site URL is: http://www.marshalldesigns.com
My site statistics page is : http://www.marshalldesigns.com/viewstats.php

Below is my table in mysql:

CREATE TABLE `statistical` (
`id` int(11) NOT NULL auto_increment,
`ip` varchar(25) NOT NULL default '',
`date` varchar(50) NOT NULL default '',
`subfolder` varchar(65) NOT NULL default '',
`os` varchar(250) NOT NULL default '',
`referrer` varchar(250) NOT NULL default '',
PRIMARY KEY (`id`)
)

Here is my script used to insert the informaiton into the database:
"/astatistic.php"

PHP Code:
<? 
$username 
""
$password ""
$host ""
$database ""
mysql_connect($host,$username,$password) or die("Cannot connect to the database.<br>" mysql_error()); 
mysql_select_db($database) or die("Cannot select the database.<br>" mysql_error()); 

$ip $_SERVER['REMOTE_ADDR']; 
$date date("D M j g:ia"); 
$subfolder $_SERVER['PHP_SELF']; 
$os $_SERVER['HTTP_USER_AGENT']; 
$referrer $_SERVER['HTTP_REFERER']; 

$result=mysql_query("INSERT INTO statistical (ip, date, subfolder, os, referrer) VALUES ('$ip','$date','$subfolder','$os','$referrer')")or die("Insert Error: ".mysql_error()); 

?>
Thanks, and god bless, I really hope that someone can help me figure out how to place the user only oncel into my database and display only that once not five million of the same person stats. Thanks again.
Sincerley,
Steve Marshall
steve@marshalldesigns.com


__________________
Mr. Marshall
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On