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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| <?php
.........
/*chargement*/
public function load($id)
{
$bdd = new BDD();
if($bdd ->connect()!=false)
{
$res = mysql_query("SELECT * FROM products WHERE products_id = '".$id."'");
if(mysql_num_rows($res) == 0)
{
$this->error = "Le produit avec l'id pr�cis� n'existe pas !";
return false;
}
while ($value = mysql_fetch_array($res))
{
$this->id = $res['products_id'];
$this->name = $value['products_name'];
$this->description = $value['products_description'];
$this->price = $value['products_price'];
$this->tax = $value['products_tax'];
$this->count = $value['products_count'];
$this->error='';
}
}
else
{
return false;
}
$bdd -> deconnecter();
}
?> |
Partager