I have a popup rotator that count unic user's ip per day(NO duplicate ip is allowed for user in same date)
$userip = mysql_real_escape_string($_SERVER['REMOTE_ADDR']);
$date = date('Y-m-d');
$result = mysql_query("SELECT `ip` FROM  `popupip` where ip = '$userip' AND userid = $secid AND date='$date'");
$num = mysql_num_rows($result);
    if ($num > 0) {
    // **it is duplicate Do not insert it in popupip table**
    }else{
    // **it is not duplicate ip insert it in popupip table**
    }
above code is an example.I know full code.
but when I look to my phpmyadmin popupip table there is a few duplicate ip for user (the exact same ip address for the user on the same date) 
how is it possible?
extra information: 
in popupip userid is int(11) , date is "date type like 2014-05-30" and ip is varchar.
 this page may opens "as fast as possible at the same time" by popup pages. is there a relation between openning a page fast at same time by a user and duplicate ip creation? is there a bug in MySQL? (maybe a big bug!!!!)
 
     
     
    