PDO UPDATE not updating...
Posted: Sun Jan 19, 2014 4:49 pm
Can anayone give me a reason that this will not update the db?
It runs with no errors but will not update. The ID is correct and POST data is valid.
It runs with no errors but will not update. The ID is correct and POST data is valid.
Code: Select all
// update the db
$sql = "UPDATE customers
SET business_contact = :business_contact,
business_name = :business_name,
first_name = :first_name,
last_name = :last_name,
address = :address,
city = :city,
state = :state,
zip = :zip,
phone = :phone,
cell_phone = :cell_phone,
e_mail= :e_mail,
m_address = :m_address,
m_city = :m_city,
m_state = :m_state,
m_zip = :m_zip,
m_name = :m_name
WHERE id = :id";
$stmt = $db->prepare($sql);
$stmt->bindParam(':business_contact', $_POST['business_contact']);
$stmt->bindParam(':business_name', $_POST['business_name']);
$stmt->bindParam(':first_name', $_POST['first_name']);
$stmt->bindParam(':last_name', $_POST['last_name']);
$stmt->bindParam(':address', $_POST['address']);
$stmt->bindParam(':city', $_POST['city']);
$stmt->bindParam(':state', $_POST['state']);
$stmt->bindParam(':zip', $_POST['zip']);
$stmt->bindParam(':phone', $_POST['phone']);
$stmt->bindParam(':cell_phone', $_POST['cell_phone']);
$stmt->bindParam(':e_mail', $_POST['e_mail']);
$stmt->bindParam(':m_address', $_POST['m_address']);
$stmt->bindParam(':m_city', $_POST['m_city']);
$stmt->bindParam(':m_state', $_POST['m_state']);
$stmt->bindParam(':m_zip', $_POST['m_zip']);
$stmt->bindParam(':m_name', $_POST['m_name']);
$stmt->bindParam(':id', $customer_id);
$stmt->execute();