I am building a small web app that allows users to write a feedback in a MySQL database. Here is the function that takes care of writing the feedback:
public function add(Feedback $feedback) {
$query = $this->db->prepare('INSERT INTO feedback SET country = :country, country-other = :countryOther, find-out = :findOut, find-out-other = :findOutOther, what-tour = :whatTour, booking-rating = :bookingRating, booking-comments = :bookingComments, checkin-rating = :checkinRating, checkin-comments = :checkinComments, journey-rating = :journeyRating, journey-comments = :journeyComments, guides-informative-rating = :guidesInformativeRating, guides-informative-comments = :guidesInformativeComments, guides-professional-rating = :guidesProfessionalRating, guides-professional-comments = :guidesProfessionalComments, tour-rating = :tourRating, tour-comments = :tourComments, tour-length = :tourLength, recommendation = :recommendation, comments = :comments');
$query->bindValue(':country', $feedback->country());
$query->bindValue(':countryOther', $feedback->countryOther());
$query->bindValue(':findOut', $feedback->findOut());
$query->bindValue(':findOutOther', $feedback->findOutOther());
$query->bindValue(':whatTour', $feedback->whatTour());
$query->bindValue(':bookingRating', $feedback->bookingRating());
$query->bindValue(':bookingComments', $feedback->bookingComments());
$query->bindValue(':checkinRating', $feedback->checkinRating());
$query->bindValue(':checkinComments', $feedback->checkinComments());
$query->bindValue(':journeyRating', $feedback->journeyRating());
$query->bindValue(':journeyComments', $feedback->journeyComments());
$query->bindValue(':guidesInformativeRating', $feedback->guidesInformativeRating());
$query->bindValue(':guidesInformativeComments', $feedback->guidesInformativeComments());
$query->bindValue(':guidesProfessionalRating', $feedback->guidesProfessionalRating());
$query->bindValue(':guidesProfessionalComments', $feedback->guidesProfessionalComments());
$query->bindValue(':tourRating', $feedback->tourRating());
$query->bindValue(':tourComments', $feedback->tourComments());
$query->bindValue(':tourLength', $feedback->tourLength());
$query->bindValue(':recommendation', $feedback->recommendation());
$query->bindValue(':comments', $feedback->comments());
// $query = $this->db->prepare('INSERT INTO feedback (country) VALUES (:country)');
// $country = $feedback->country();
// echo $country;
// $query->bindParam(':country', $country);
$query->execute();
}
Commented lines show a test I did to see if it was writing on DB, and it's not.
So the problem is that I don't get any error message. I am sure I am correctly connected to the database (this same function was working on the first draw of the project, which included a much simpler DB).
I checked the $feedback object contains all the correct parameters, and it does.
So what is my mistake, here? Thanks for your help.