Can someone explain what the following bit of code does, or better yet, how it does it? I know it inserts values into a database but it's written in a way that I've never seen. By the way, I'm very new to PHP and MySQL.
I don't understand the use of ` because I've always used ', and then the ?,? in the values field is strange too. Why not just write it as:
$insert = "INSERT INTO attempts (`ip`, `when`) VALUES ( ?, ? )";
$data = array($_SERVER['REMOTE_ADDR'], date("Y-m-d H:i:s"));
$input = $pdo->prepare($insert);
I'm figuring there must be a reason for the first method...or not.
$ip = $_SERVER['REMOTE_ADDR'];
$when = date("Y-m-d H:i:s");
$insert = mysql_query("INSERT INTO attempts (ip, when) VALUES ('$ip', '$when')");