我有一个产品列表页面,我正在尝试弄清楚如何将产品标签放在所选项目上。我有一个类别$畅销书,我希望他们的右上角有一个畅销图像标签。
有任何帮助吗?感谢。
<?php
include "storescripts/connect_to_mysql.php";
$dynamicList = "";
$sql = mysql_query("SELECT * FROM products ORDER BY date_added DESC LIMIT 15");
$productCount = mysql_num_rows($sql); // count the output amount
$i = 0;
$dynamicList = '<table border="1" bordercolor="#d6d6d6" cellpadding="10"
cellspacing="0" style="border-collapse:collapse;">';
while($row = mysql_fetch_array($sql)){
$id = $row["id"];
$brand = $row["brand"];
$product_name = $row["product_name"];
$pdetails = $row["pdetails"];
$bestseller = $row["bestseller"];
$details = $row["details"];
$date_added = strftime("%b %d, %Y", strtotime($row["date_added"]));
if ($i % 3 == 0) { // if $i is divisible by our target number (in
this case "3")
$dynamicList .= '<tr><td><a href="product.php?id=' . $id . '"
title="' . $pdetails . '"><img src="inventory_images/' . $id . '.jpg" width="295"
border="0" ><br><br>' . $brand . '<br>' . $product_name . '</a></td>';
} else {
$dynamicList .= '<td><a href="product.php?id=' . $id . '" title="' .
$pdetails . '"><img src="inventory_images/' . $id . '.jpg" width="295" border="0" >
<br><br>' . $brand . '<br>' . $product_name . '</a></td>';
}
$i++;
}
$dynamicList .= '</tr></table>';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"/>
<title>Product List</title>
<link rel="shortcut icon" href="icon.png" />
<link rel="icon" href="icon.png" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="../rustansstyle.css" />
</head>
<body marginwidth="0" marginheight="0" leftmargin="0" rightmargin="0" topmargin="0"
bottommargin="0">
<center>
<div id="mainWrapper">
<?php include_once("header.php");?>
<div id="pagetitle_skincare" style="margin-top:0px;"></div>
<table border="0">
<tr>
<td valign="top" width="230">
<div id="product_category">
<li><a href="#">Dresses</a></li>
<li><a href="#">Short Dresses</a></li>
<li><a href="#">Maxi Dresses</a></li>
<li><a href="#">Cocktail Dresses</a></li>
</div>
</td>
<td valign="top" width="950">
<div class="preview_inner"><?php echo $dynamicList; ?></div></td>
</tr>
</table>
<br />
<br /><?php include_once("footer.php");?>
</div>
</center>