Bonjour,
Ca fait un moment que je galère avec une erreur mysql que j'arrive pas à résoudre, ce serait bien sympathique de votre part de me donner un coup de main, et Merci infiniment
SELECT DISTINCT * FROM Employes,Service,Departement,Affectation,historique WHERE Service.IDService=Affectation.IDService AND Employes.IDEmployes=historique.IDEmployePointages AND Service.IDDepartement=Departement.IDDepartement AND Employes.UIDEmployes=Affectation.IDEmployes AND ActiveEmp!=0 AND Service.IDService=6 AND Departement.IDDepartement=1 AND historique.seances=S2 AND historique.DatePointages BETWEEN '2023-03-05' AND '2023-03-05'
Erreur PHP :
Fatal error: Uncaught PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'S2' in 'where clause' in C:\xampp\htdocs\ismagip\control\F_ShowPointage.php:89 Stack trace: #0 C:\xampp\htdocs\ismagip\control\F_ShowPointage.php(89): PDO->query('SELECT DISTINCT...') #1 {main} thrown in C:\xampp\htdocs\ismagip\control\F_ShowPointage.php on line 89
mon code php :
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
| //recuperation des valeurs
$IDDep = $_GET['Dep'] ?? "";
$IDSer = $_GET['Ser'] ?? "";
$IDEmp = $_GET['Emp'] ?? "";
$IDSea = $_GET['Sea'] ?? "";
$TxtIDDep = $_GET['DepTxt'] ?? "";
$TxtIDSer = $_GET['SerTxt'] ?? "";
$TxtIDEmp = $_GET['EmpTxt'] ?? "";
$TxtIDSea = $_GET["SeaTxt"] ?? "";
if ($_GET['DateFrom'] ?? "") {
$DateFrom = new DateTime($_GET['DateFrom'] ?? "");
}
if ($_GET['DateTo'] ?? "") {
$DateTo = new DateTime($_GET['DateTo'] ?? "");
}
$DayDiff = $_GET['DayDiff'] ?? "";
$SqlRecherche = null;
$Resultat = "";
$diff = null;
if (!empty($DateFrom) && !empty($DateTo)) {
if ($IDEmp == 'T') {
$SqlRecherche = "SELECT DISTINCT * FROM Employes,Service,Departement,Affectation,historique WHERE Service.IDService=Affectation.IDService AND Employes.IDEmployes=historique.IDEmployePointages AND Service.IDDepartement=Departement.IDDepartement AND Employes.UIDEmployes=Affectation.IDEmployes AND ActiveEmp!=0 AND Service.IDService=".$IDSer." AND Departement.IDDepartement=".$IDDep." AND historique.seances=".$TxtIDSea." AND historique.DatePointages BETWEEN '".$DateFrom->format('Y-m-d')."' AND '".$DateTo->format('Y-m-d')."' "; |
Partager