Thanks for the tip
I've got it working using this code.. is there anything I could do better here?
$email = $line[$emailkey];
$checkdupes = "SELECT * from \"leads\" WHERE \"e-mail\" = '{$email}'";
$emailresult = pg_query($conn, $checkdupes);
if ($dupes = pg_fetch_row($emailresult)){
echo 'Line: ' . $row . ' ' . $line[$namekey] . ' ' . $line[$emailkey] . ' is a duplicate<br><br>';
$rowsinserted--;
}
elseif(empty($email)){
echo 'Line: ' . $row . ' ' . $line[$namekey] . ' ' . $line[$emailkey] . ' has no email address<br><br>';
$rowsinserted--;
}
elseif(empty($telephone)){
echo 'Line: ' . $row . ' ' . $line[$namekey] . ' ' . $line[$emailkey] . ' has no phone number<br><br>';
$rowsinserted--;
}
else {
if ($age < 25){
echo 'Line: ' . $row . ' ' . $line[$namekey] . ' ' . $line[$emailkey] . ' is a under 25 years old<br><br>';
$rowsinserted--;
}
$status = insertRow('leads', $vars, $nulls, $format, $types);