$query = "INSERT INTO api_fails (file, code, url, date) VALUES (?, ?, ?, ".time().")";
$stmt = $mysqli->stmt_init();
if(!$stmt->prepare($query)) {
echo("Failed to prepare statement.<br />\n");
} else {
$file = $_GET['f'];
$code = $_GET['c'];
$url = $_GET['u'];
$stmt->bind_param("sis", $file, $code, $url);
if($stmt->execute()) {
echo("Inserted.<br />\n");
}else {
echo("Didn't insert.<br />\n");
}
}
I have found if any of the following variables are not set, the insert fails...
$file = $_GET['f'];
$code = $_GET['c'];
$url = $_GET['u'];
How do I setup my insert so that if the variable isn't set it just inserts nothing into that field?