您好,我正在尝试以下代码块,虽然也没有将数据插入数据库,但没有收到错误。此外,正在发送 POST 值。
任何帮助表示赞赏:
if(!empty($firstName) && !empty($lastName) && !empty($cell)){
$sql = "SELECT * FROM clientInformation WHERE firstName = '$firstName' AND lastName = '$lastName' AND cell = '$cell' LIMIT 1;";
if(!$result = $con->query($sql)){
die('There was an error running the query [' . $con->error . ']');
}else{
$numRows = $result->num_rows;
}
if($numRows > 0){
$newResult = $result->fetch_assoc();
}else{
$sql = "INSERT INTO clientInformation (firstName, lastName, address, city, zip, phone, cell, state, email) VALUES ('$firstName', '$lastName', '$address', '$city', '$zip', '$phone', '$cell', '$state', '$email');";
if(!$result = $con->query($sql)){
die('There was an error running the query [' . $con->error . ']');
}
}
}