Results 1 to 3 of 3

Thread: How do you overwrite entry in MySQL?

Threaded View

  1. #1

    Thread Starter
    PowerPoster eiSecure's Avatar
    Join Date
    Jul 2000
    Location
    Texas
    Posts
    2,209

    How do you overwrite entry in MySQL?

    Okay, I have this code so far:
    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!"); 
    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?
    Last edited by eiSecure; Mar 19th, 2002 at 06:23 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width