connect_errno > 0){
die(‘Unable to connect to database [‘ . $link->connect_error . ‘]’);
}
if (!$link->set_charset(“utf8”)) {
printf(“Error loading character set utf8: %s\n”, $link->error);
}
$imageID = $_POST[‘imageID’];
$user_ID = get_current_user_id();
$query = “INSERT INTO contest_votes VALUES (‘”.$user_ID.”‘, ‘”.$imageID.”‘)”;
if(!$result = $link->query($query)){
die(‘There was an error running the query [‘ . $link->error . ‘]’);
}
$deleteQuery = “DELETE FROM `contest_votes` WHERE imageID = 0”;
if(!$result = $link->query($deleteQuery)){
die(‘There was an error running the query [‘ . $link->error . ‘]’);
}
echo ““;
?>