par
Doudou52 » 20 mai 2014, 08:30
Bonjour à tous.
Je suis actuellement en stage IRIS 1er année, et je dois reprendre un logiciel de bon de commande d'un autre élève sans aucun commentaire, afin de le terminer. Problème, c'est que je suis actuellement bloqué.
Quand je clique sur Commande en cours, j'ai le droit à se message :
Voici le morceau de code concerné :
Code : Tout sélectionner
<?php
class communication
{
public $bdd;
public function connexion()
{
try{
$this->bdd = new PDO("mysql:host=localhost;dbname=commande","root","");
$this->bdd->query("SET NAMES UTF8");
}
catch(Exception $e)
{
die ($e->getMessage());
}
}
public function query($sql)
{
try
{
$reponse = $this->bdd->query($sql); [color=#FF0000]//LIGNE 24[/color]
$retour = null;
$i = 0;
if(!empty($reponse))
{
while($row = $reponse->fetch(PDO::FETCH_ASSOC))
{
foreach($row AS $k => $v)
{
$retour[$i][$k] = $v;
}
$i++;
}
}
return $retour;
}
catch(Exception $e)
{
return null;
}
}
public function exec($sql)
{
$this->bdd->exec($sql);
}
}
?>
Et je bloque complétement.
Merci au personne qui pourront m'aider.
Bonjour à tous.
Je suis actuellement en stage IRIS 1er année, et je dois reprendre un logiciel de bon de commande d'un autre élève sans aucun commentaire, afin de le terminer. Problème, c'est que je suis actuellement bloqué.
Quand je clique sur Commande en cours, j'ai le droit à se message :
[url=http://www.hostingpics.net/viewer.php?id=757672Sanstitre.png][img]http://img4.hostingpics.net/pics/757672Sanstitre.png[/img][/url]
Voici le morceau de code concerné : [code]<?php
class communication
{
public $bdd;
public function connexion()
{
try{
$this->bdd = new PDO("mysql:host=localhost;dbname=commande","root","");
$this->bdd->query("SET NAMES UTF8");
}
catch(Exception $e)
{
die ($e->getMessage());
}
}
public function query($sql)
{
try
{
$reponse = $this->bdd->query($sql); [color=#FF0000]//LIGNE 24[/color]
$retour = null;
$i = 0;
if(!empty($reponse))
{
while($row = $reponse->fetch(PDO::FETCH_ASSOC))
{
foreach($row AS $k => $v)
{
$retour[$i][$k] = $v;
}
$i++;
}
}
return $retour;
}
catch(Exception $e)
{
return null;
}
}
public function exec($sql)
{
$this->bdd->exec($sql);
}
}
?>[/code]
Et je bloque complétement.
Merci au personne qui pourront m'aider.