Okay, I have this code so far:When I run that, it displays the viewer's name correctly, but if the user returns, his name is displayed again! How would I make it so that the name of the user is shown only once?PHP Code:$ip = getenv("REMOTE_ADDR");
$view_date = date("F j, Y");
echo "<br>Your IP address is $ip<br>Today's date is $view_date.";
$sql = "SELECT * FROM page_view";
$connection = mysql_connect("localhost", "**********", "**********") or die("Could not connect.");
$db = mysql_select_db(**********, $connection) or die("Could not select database.");
$result = mysql_query($sql,$connection);
echo "<br>The following people have visited this website:<br>";
while ($row = mysql_fetch_array($result)) {
$id = $row['id'];
$username = $row['username'];
$ip = $row['ip'];
$view_date = $row['view_date'];
echo "$username<br>";
}
$sql = "REPLACE INTO `page_view` (`id`, `username`, `ip`, `date`) VALUES ('', '$user', '$ip', '$view_date')";
$result = mysql_query($sql,$connection) or die("ERROR2!");





Reply With Quote