Bonjour j'ai ecrit un script a parir d'un tutorial que j ai vu sur le Net, pour un site de e-commerce afin de creer un display sous forme de tableau,
Cependant le script ne marche pas .. les photos ne s alignant pas ..
voila le script si quelqu'un pourrait y jeter un coup d oeuil...
<?php
//Run a select query
include"storescripts/connect_to_mysql.php";
$dynamicList = "";
$sql = mysql_query("SELECT * FROM products ORDER BY date_added DESC");
$i = 0;
$productCount = mysql_num_rows($sql); // count the output amount
if ($productCount > 0) {
while($row = mysql_fetch_array($sql)){
$id = $row["id"];
$product_name = $row["product_name"];
$price = $row["price"];
$date_added = strftime("%b %d, %Y", strtotime($row["date_added"]));
if ($i % 4 == 0) {
$dynamicList .= '<table width="18%" border="0" cellspacing="0" cellpadding="6">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="6">
<tr>
<td><div align="center"><a href="product.php?id=' . $id . '"><img src="inventory_images/' . $id . '.jpg" width="160" height="160" /></a></div></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="6">
<tr>
<td width="73%">Prix: $' . $price . ' </td>
<td width="27%">Details</td>
</tr>
</table></td>
</tr>
</table></td>';
} else {
$dynamicList .= '<td><table width="100%" border="0" cellspacing="0" cellpadding="6">
<tr>
<td><div align="center"><a href="product.php?id=' . $id . '"><img src="inventory_images/' . $id . '.jpg" width="160" height="160" /></a></div></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="6">
<tr>
<td width="73%">Prix: $' . $price . ' </td>
<td width="27%">Details</td>
</tr>
</table></td>';
}
$i++;
}
$dynamicList .= ' </tr></table>';
}
else {
$dynamicList = "You have no products listed in our store yet";
}
mysql_close();
?>
Merci bcp les amis !