Ive been starting at the computer screen for hours (doesn't help that Adobe Dreamweaver has a white background)
Question
I can't find this error to save my life, would greatly appreciate it if someone could give this a scan and tell me where i am going wrong!
Advice Needed
Im new to PDO and just made the switch i'm slowly getting the hang of it but i'm battling with debugging, when using mysql queries with PDO
in php. It was rather easy to find the query errors on the old mysql_*
method but as a PDO novice i'm having a hard time debugging. What would be the closes PDO alternative to mysql_error()
? Any help and advice appreciated.
Codde Below (please keep in mind i'm a novice so code might not be the prettiest)
$resId = $_POST['resId'];
$name = $_POST['name'];
$surname = $_POST['surname'];
$coverName = $_POST['coverName'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$carType = $_POST['carGroup'];
$pickupDate = $_POST['pickupDate'];
$pickupTime = $_POST['pickupTime'];
$returnDate = $_POST['returnDate'];
$returnTime = $_POST['returnTime'];
$rentalPeriode = $interval->format('%d'); //calculates correct
$sql = 'UPDATE car_reservations SET
renter_name = :renter_name,
renter_lastname = :renter_lastname,
email = :email,
phone = :phone,
pickup_date = :pickup_date,
return_date = :return_date,
number_days = :number_days,
insurance = :insurance,
car_group = :car_group,
return_time = :return_time,
pickup_time = :pickup_time
WHERE res_id = $resId';
$statement = $db->prepare($sql);
$statement->bindValue(':renter_name', $name);
$statement->bindValue('renter_lastname', $surname);
$statement->bindValue(':email', $email);
$statement->bindValue(':phone', $phone);
$statement->bindValue(':pickup_date', $pickupDate);
$statement->bindValue(':return_date', $returnDate);
$statement->bindValue(':number_days', $rentalPeriode);
$statement->bindValue(':insurance', $coverName);
$statement->bindValue('carType', $carType);
$statement->bindValue(':return_time', $returnTime );
$statement->bindValue(':pickup_time', $pickupTime );
$success = $statement->execute();
Error
: Invalid parameter number: parameter was not defined