Affichage dans un tableau

Résolu
stu76 Messages postés 186 Date d'inscription samedi 5 mars 2005 Statut Membre Dernière intervention 17 février 2008 - 5 janv. 2006 à 12:39
stu76 Messages postés 186 Date d'inscription samedi 5 mars 2005 Statut Membre Dernière intervention 17 février 2008 - 5 janv. 2006 à 22:51
Boujour et meilleur voeux à tous,

J'ai un problème d'affichage dans mon tableau, j'ai fait un script en php tout ce qui a de plus banale. Quand je l'exécute sur mon navigateur les données s'affiche au-dessus de tableau et non dedans. Ca fait des heures que je cherche et je ne vois toujours pas pourquoi. Ci quelque pouvait m'aider se serait sympa .
Voici le source :


<?php require_once('Connections/ecommerce.php'); ?>
<?php
$colname_articles = "1";
if (isset($_GET['id'])) {
$colname_articles = (get_magic_quotes_gpc()) ? $_GET['id'] : addslashes($_GET['id']);
}
mysql_select_db($database_ecommerce, $ecommerce);$query_articles sprintf("SELECT * FROM shop_articles WHERE id %s ORDER BY id ASC", $colname_articles);
$articles = mysql_query($query_articles, $ecommerce) or die(mysql_error());
$row_articles = mysql_fetch_assoc($articles);
$totalRows_articles = mysql_num_rows($articles);


$idURL_fabricant = "1";
if (isset($_GET['id'])) {
$idURL_fabricant = (get_magic_quotes_gpc()) ? $_GET['id'] : addslashes($_GET['id']);
}
mysql_select_db($database_ecommerce, $ecommerce);
$query_fabricant = sprintf("SELECT shop_articles.id, shop_fabricant.id, shop_fabricant.nom, shop_fabricant.url FROM shop_articles inner join shop_fabricant on shop_fabricant.id= shop_articles.fabricant WHERE shop_articles.id= %s", $idURL_fabricant);
$fabricant = mysql_query($query_fabricant, $ecommerce) or die(mysql_error());
$row_fabricant = mysql_fetch_assoc($fabricant);
$totalRows_fabricant = mysql_num_rows($fabricant);
?>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Articles</title>
<style type="text/css">
<!--
.Style1 {font-family: Arial, Helvetica, sans-serif}
.Style3 {font-family: Arial, Helvetica, sans-serif; font-weight: bold; }
body,td,th {
color: #FFFFFF;
font-family: Arial, Helvetica, sans-serif;
}
body {
background-color: #333333;
background-image: url(images/fondsite.gif);
}
a:link {
color: #FFFFFF;
text-decoration: none;
}
a:visited {
color: #FFFFFF;
text-decoration: none;
}
a:hover {
color: #FF0000;
text-decoration: none;
}
a:active {
text-decoration: none;
}
-->
</style>
</head>



N&deg;,
Fabricant,
Nom d'article ,
Prix HTVA en &euro; ,
Prix TVAC en &euro; ,

----

<?php echo $row_articles['id']; ?>,
"> <?php echo $row_articles[Fabricant]; ?>,
<?php echo $row_articles[nom_article]; ?>,
<?php echo $row_articles[prix_ht]; ?>,
<?php echo $row_articles[prix_ttc]; ?>

<?php
mysql_select_db($database_ecommerce, $ecommerce);
$sql='SELECT shop_articles.id, shop_articles.nom_article, shop_articles.prix_ht, shop_articles.prix_ttc, shop_articles.fabricant
FROM shop_articles';
$req=mysql_query($sql) or die('Erreur SQL!
'.$sql.'
'.mysql_error());
while (print_r ($row_articles=mysql_fetch_array($req)))
{
echo '
'.$row_articles[id].' '.$row_articles[fabricant].' '.$row_articles[nom_article].' '.$row_articles[prix_ht].' '.$row_articles[prix_ttc].'
';
}
mysql_close();
?>

</html>
<?php
mysql_free_result($fabricant);


mysql_free_result($articles);
?>

Merci d'avances, pour l'aide et pour le temps que vous m'accordez,

@+

Stu76

2 réponses

sidf Messages postés 1216 Date d'inscription mardi 20 décembre 2005 Statut Membre Dernière intervention 18 octobre 2012 5
5 janv. 2006 à 17:20
salut
pour la structure, il me semble que le remplissage des lignes du tableau
devrait se trouver dans la boucle while, non?
genre

... entetes de colonnes

while...
{
----

...,
...

}
3
stu76 Messages postés 186 Date d'inscription samedi 5 mars 2005 Statut Membre Dernière intervention 17 février 2008 1
5 janv. 2006 à 22:51
Merci sidf,

Tu as raison le problème était bien là, mais j'avais trouvé le réponse sur un autre site. C'est super sympa de ta part quand même, merci .

@+ et bonne prog,

Stu76
0
Rejoignez-nous