<?php
$conn = mysqli_connect('localhost', 'BinKill', 'password removed', 'tk_development');
$ip = $_SERVER['REMOTE_ADDR'];
$date = Date("d/mY, g:i:s");
if(mysqli_connect_errno()){
die("Connection failed: " . mysqli_connect_error());
} else {
$query = "INSERT INTO `logs` (ip,date) VALUES (`$ip`, `$date`)";
$result = mysqli_query($conn, $query);
if(!$result){
die("Could not Execute Query: " . mysqli_error());
}
mysqli_close($conn);
}
?>
Above is the code I'm using to try and log the IP of the user accessing the page and the date of which they accessed it. However when this is ran, all that is returned is: Could not Execute Query:
No error. Not sure what's going on exactly.
ini_set('display_errors',1); error_reporting(E_ALL);to the start of your PHP code and try, report back to me what you get.mysqli_error($conn)