par
alex288 » 19 août 2008, 17:01
je suis capable d`afficher l`image de la base de donnee mais j`arrive pas a afficher ses informations lies a une autre table ( ref de produit, prix, description).
Table image (img_id, img_nom, img_taille, img_type, img_blob)
table produit (ref_produit, description, titre, prix, img_id)
fichier apercu.php
if ( isset($_GET['id']) )
{
$id = intval ($_GET['id']);
$db = mysql_connect("localhost","root","");
$ret = mysql_select_db("boutique",$db) or die (mysql_error ());
$req = "SELECT image.img_id, image.img_type, image.img_blob, produit.ref_produit, produit.titre, produit.description FROM image, produit WHERE image.img_id = ".$id;
?>
fichier affichage.php
PHP:
<?php
$db = mysql_connect("localhost","root",""); // connexion a la base de donnee
$ret = mysql_select_db("boutique",$db) or die (mysql_error ()); // selection de la base de donnee
//$ref_produit = $_POST["ref_produit"] ;
$req = "SELECT image.img_nom, image.img_id FROM image ORDER BY image.img_nom";
//$req = "SELECT image.img_nom, image.img_id, produit.ref_produit, produit.titre, produit.description, produit.prix FROM image, produit where image.img_id = produit.img_id ORDER BY image.img_nom";
$ret = mysql_query ($req) or die (mysql_error ());
//$ret = mysql_query ($req2) or die (mysql_error ());
while ( $col = mysql_fetch_row ($ret) )
{
echo "<a href=\"apercu.php?id=".$col[1].
"\">".$col[0]."</a><br /> ";
//echo "Details:";
}
?>
merci pour votre aide[/code][/php]
je suis capable d`afficher l`image de la base de donnee mais j`arrive pas a afficher ses informations lies a une autre table ( ref de produit, prix, description).
Table image (img_id, img_nom, img_taille, img_type, img_blob)
table produit (ref_produit, description, titre, prix, img_id)
fichier apercu.php
if ( isset($_GET['id']) )
{
$id = intval ($_GET['id']);
$db = mysql_connect("localhost","root","");
$ret = mysql_select_db("boutique",$db) or die (mysql_error ());
$req = "SELECT image.img_id, image.img_type, image.img_blob, produit.ref_produit, produit.titre, produit.description FROM image, produit WHERE image.img_id = ".$id;
?>
fichier affichage.php
PHP:
<?php
$db = mysql_connect("localhost","root",""); // connexion a la base de donnee
$ret = mysql_select_db("boutique",$db) or die (mysql_error ()); // selection de la base de donnee
//$ref_produit = $_POST["ref_produit"] ;
$req = "SELECT image.img_nom, image.img_id FROM image ORDER BY image.img_nom";
//$req = "SELECT image.img_nom, image.img_id, produit.ref_produit, produit.titre, produit.description, produit.prix FROM image, produit where image.img_id = produit.img_id ORDER BY image.img_nom";
$ret = mysql_query ($req) or die (mysql_error ());
//$ret = mysql_query ($req2) or die (mysql_error ());
while ( $col = mysql_fetch_row ($ret) )
{
echo "<a href=\"apercu.php?id=".$col[1].
"\">".$col[0]."</a><br /> ";
//echo "Details:";
}
?>
merci pour votre aide[/code][/php]