I'm trying to create an sql query that will show me the prices of the services selected by one user within a reservation.
So I want to select the id_service
column from my table chosen_services
where the id_reservation
coresponds to the $_SESSION['idReservation']
and get the price of these services and finaly calculate the total.
here are my 2 tables in mysql : https://ibb.co/NtgLLh7 and https://ibb.co/jkB0Qm6
Here's my query for the moment :
$getPriceOfAllServices = $bdd->prepare(
'SELECT id_service
FROM CHOSEN_SERVICES
LEFT JOIN SERVICES ON CHOSEN_SERVICES.id_chosen_service = SERVICES.id_service
WHERE id_reservation = ?'
);
$getPriceOfAllServices->execute(array($_SESSION['idReservation']));
$getPriceOfAllServices = $getPriceOfAllServices->fetch();
And I have this error : https://ibb.co/Wc1hLvz
Thanks in advance!