I have a php my admin database,
I don't know very much how to structure it but following this answer I Made a
ip int(11) UNSIGNED
value for the IP
I would like to store the IP of user, so that they can't access twice to my page.
I do the following query
$ip = inet_pton($_SERVER['REMOTE_ADDR']);
$request = "INSERT INTO `users` (`ip`) VALUES (".$ip.")";
$result = $dbh->query($request);
but this give me an empty value. and nothing is added to the database
EDIT :
So full request is :
function getIPforBDD(){
return inet_pton($_SERVER['REMOTE_ADDR']);
}
$request = "INSERT INTO `users` (`ip`, `finish`, `lastPage`) VALUES (".getIPforBDD().", ".$GLOBALS["userHasFinish"].", questionnaire_initial.php)";
$result = $dbh->query($request);