I am a very novice programmer and am just beginning to use php. I am using php to get the user ip store it in mysql. try inserting the ip to the mysql db. if it is already there then update the visit count. But none of my queries are working. It is returning that I am connected to my db This is what i have so far:
$ipaddress = $_SERVER["REMOTE_ADDR"];
print "$ipaddress <br>";
$rv = mysqli_real_query("INSERT INTO visit ( ipaddress, count) VALUES ( '$ipaddress', 1)");
if ($rv === false){
mysqli_real_query($con,"UPDATE visit SET count=count+1
WHERE ipaddress = '$ipaddress'");
mysqli_close($con);
}
mysqli_close($rv);
$count = mysqli_real_query("SELECT count from visit where ipaddress = '$ipaddress'");
print "You have visited this site $count time(s)";