Uncaught PDOException: SQLSTATE[23000]: erreur where close
Bonjour,
je comprend pas d'où provient l'erreur
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
$stmt = $dbh->prepare("
SELECT
DATE(debut) AS date,
slots.*,
appointments.*,
slots.id AS slot_id,
appointments.id AS appointment_id,
TIME_TO_SEC(TIMEDIFF(TIME(debut), :min)) DIV TIME_TO_SEC(TIMEDIFF(fin, debut)) AS row
FROM slots
LEFT JOIN appointments_slots ON slots.id = appointments_slots.slot_id
LEFT JOIN appointments ON appointments_slots.appointment_id = appointments.id
WHERE
TRUE
AND debut >= :from
AND debut <= :to
AND user_soc = :user_soc
ORDER BY debut
"
);
$stmt->execute(
[
'min' => $stats['min'],
'to' => $to->format('Y-m-d H:i:s'),
'from' => $from->format('Y-m-d H:i:s'),
'user_soc' => $userid,
]
);
$slots = $stmt->fetchAll(PDO::FETCH_GROUP | PDO::FETCH_ASSOC); |
Fatal error: Uncaught PDOException: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'user_soc' in where clause is ambiguous
J'ai bien user_soc dans ma base de donnée