par
hend56 » 20 janv. 2013, 18:00
J'ai ecrit ceci mais cela bloque sur
Fatal error: Undefined class constant 'FETCH_OBJECT' in C:\ ....
try
{
// ---------- On se connecte à MySQL
//$bdd = new PDO('mysql:host=localhost;dbname=web42-roberts', 'web42-roberts', '19011956', $pdo_options);
$bdd = new PDO('mysql:host=localhost;dbname=web42-roberts', 'root', '');
}
catch(Exception $e)
{
// ---------- En cas d'erreur, on affiche un message et on arrête tout
die('Erreur : '.$e->getMessage());
}
$reponse = $bdd->prepare('SELECT id FROM occupation WHERE MONTH(date_debut) = ? AND YEAR(date_debut) = ?');
$reponse ->execute(array($mois_parcouru, $annee_parcourue));
$classement = 1;
while ($donnees = $reponse ->fetch(PDO::FETCH_OBJECT))
{
$reponse = $bdd->prepare('UPDATE occupation SET classement = ? where id = ? ');
$reponse ->execute(array($classement,$donness->id));
$classement=$classement+1;
}
J'ai ecrit ceci mais cela bloque sur
Fatal error: Undefined class constant 'FETCH_OBJECT' in C:\ ....
[php]
try
{
// ---------- On se connecte à MySQL
//$bdd = new PDO('mysql:host=localhost;dbname=web42-roberts', 'web42-roberts', '19011956', $pdo_options);
$bdd = new PDO('mysql:host=localhost;dbname=web42-roberts', 'root', '');
}
catch(Exception $e)
{
// ---------- En cas d'erreur, on affiche un message et on arrête tout
die('Erreur : '.$e->getMessage());
}
$reponse = $bdd->prepare('SELECT id FROM occupation WHERE MONTH(date_debut) = ? AND YEAR(date_debut) = ?');
$reponse ->execute(array($mois_parcouru, $annee_parcourue));
$classement = 1;
while ($donnees = $reponse ->fetch(PDO::FETCH_OBJECT))
{
$reponse = $bdd->prepare('UPDATE occupation SET classement = ? where id = ? ');
$reponse ->execute(array($classement,$donness->id));
$classement=$classement+1;
}[/php]