这是我的脚本..事情是......在这个名称,描述和价格即将到来的情况下获取图像......但我如何在旁边显示图像所有这些(名称) ,价格,desc)遵循顺序..
参考链接:http://www.qualitycodes.com/tutorials/demos/php/shopping/products.php
<body>
<div id=cart align="center">
<table border="0" cellpadding="2px" width="600px">
<h1 align="center">Products</h1>
<?php
$sql = "SELECT serial, name, description, price,picture FROM products;";
$result = mysql_query($sql) or die (mysql_error());
while(list($id, $name, $description, $price,$picture) = mysql_fetch_row($result)) {
echo "<tr>";
echo "<td align=left>";
echo "<input type='button' onClick=\"window.open('cart.php?action=add&id=" . $id . "','_self');\" value='Add to Cart' />";
echo "<hr color=grey size=\"0\" >";
echo "</td>";
echo "</tr>";
}
?>
</table>
<a href="cart.php">View Cart</a>
<input type="image" src="submit.gif" alt="Submit" width="48" height="48" />
</div>
</body>
答案 0 :(得分:0)
使用样式表
<head>
<style type="text/css">
#mainContent
{
width:600px;
}
#leftContent
{
display:inline;
float:left;
}
#rightContent
{
display:inline;
float:left;
}
</style>
</head>
<body>
<div id="mainContent">
<div id="leftContent">
<img src="filename.jpg" />
</div>
<div id="rightContent">
<?php
//Database code and values
?>
</div>
</div>
</body>