I'm trying to figure out a way to get this if statement to work..
$array = $_POST['field'];
foreach ($array as $key => $value) {
if ($value does not exist in database) {
$query = "INSERT INTO...";
elseif ($value >= 1) {
$query = "UPDATE... ";
} else {
$query = "DELETE FROM... ";
}
}
The part I cannot figure out is the first part of the if statement, if the value does not exist in the database.. Is there some way to check if that value exists so it knows whether to insert or update?