Re: How can I exclude my IP?
Date: 18 Oct 2014 13:58:41 GMT
Message-ID: <cafa0hF8tmsU1_at_mid.individual.net>
Thor:
>As I have a fairly static IP, changed only once in two years, I am
>fairly confident it won't change again for another year. I was
>thinking that perhaps there is something I could include where "on
>duplicate key" is? Or maybe something like "where $ipadd != (the
>given ip)"?
Well, since you're using PHP anyway, why would you want a solution in MySql? You don't need the roundtrip to the database server. Just exclude your IP address before even going there:
>$result = mysqli_query($link,"SELECT * FROM video1");
>$rows = mysqli_num_rows($result);
>
>$ipadd=$_SERVER['REMOTE_ADDR'];
if ($ipadd != "01.23.45.67") { # Your IP
>mysqli_query($link,"INSERT INTO video1 (ipadd,hits) VALUES
>('".$ipadd."',1) ON DUPLICATE KEY UPDATE hits=hits+1")
>or die(mysqli_error());
}
-- ErickReceived on Sat Oct 18 2014 - 15:58:41 CEST