Error: column not found
Résolu
jordxn
Messages postés
375
Statut
Membre
-
jordxn Messages postés 375 Statut Membre -
jordxn Messages postés 375 Statut Membre -
Bonsoir,
ma requête me pose problème alors qu'elle semble bonne...
if(isset($_SESSION['username']))
{
$proprietaire=($_SESSION['username']);
?>
<h1>Calendrier</h1>
<br/>
<?php
function getEventsDate($mois, $annee) {
global $pdo;
$result = array();
$sql = 'SELECT jour_taches, intitule, proprietaire FROM calendrier c join taches t on c.id_taches = t.id_taches WHERE mois_taches='.$mois.' AND annee_taches='.$annee.' AND proprietaire='.$proprietaire.' ORDER BY jour_taches';
$query = $pdo->prepare($sql);
$query->execute();
if($query)
{
}else{
die("Une requête a échouée.");
}
while ($row = $query->fetch(PDO::FETCH_NUM)){
$result[] = $row[0];
$result[] = $row[1];
}
if($pdo){
$pdo = NULL;
}
return $result;
}
etcc
Il me dise :
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'jordan' in 'where clause'' in /homez.359/momentde/www/calendrier.php:35 Stack trace: #0 /homez.359/momentde/www/calendrier.php(35): PDOStatement->execute() #1 /homez.359/momentde/www/calendrier.php(78): getEventsDate('04', '2013', 'jordan') #2 {main} thrown in /homez.359/momentde/www/calendrier.php on line 35
Sauf que j'ai bien un champ proprietaire dans la table taches et dans ce champ j'ai bien jordan...
Help please
ma requête me pose problème alors qu'elle semble bonne...
if(isset($_SESSION['username']))
{
$proprietaire=($_SESSION['username']);
?>
<h1>Calendrier</h1>
<br/>
<?php
function getEventsDate($mois, $annee) {
global $pdo;
$result = array();
$sql = 'SELECT jour_taches, intitule, proprietaire FROM calendrier c join taches t on c.id_taches = t.id_taches WHERE mois_taches='.$mois.' AND annee_taches='.$annee.' AND proprietaire='.$proprietaire.' ORDER BY jour_taches';
$query = $pdo->prepare($sql);
$query->execute();
if($query)
{
}else{
die("Une requête a échouée.");
}
while ($row = $query->fetch(PDO::FETCH_NUM)){
$result[] = $row[0];
$result[] = $row[1];
}
if($pdo){
$pdo = NULL;
}
return $result;
}
etcc
Il me dise :
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'jordan' in 'where clause'' in /homez.359/momentde/www/calendrier.php:35 Stack trace: #0 /homez.359/momentde/www/calendrier.php(35): PDOStatement->execute() #1 /homez.359/momentde/www/calendrier.php(78): getEventsDate('04', '2013', 'jordan') #2 {main} thrown in /homez.359/momentde/www/calendrier.php on line 35
Sauf que j'ai bien un champ proprietaire dans la table taches et dans ce champ j'ai bien jordan...
Help please
A voir également:
- Error: column not found
- Fan error lenovo - Forum Refroidissement
- Eespt technical error - Forum Box et Streaming vidéo
- Pour ceux qui ont "LENOVO fan error au démarrage" - Forum PC portable
- Cmos checksum error ✓ - Forum Carte-mère/mémoire
- A javascript error occurred in the main process - Forum Matériel & Système
AND proprietaire="jordan" sa marche !!
donc je fais
AND proprietaire=".$proprietaire." ?