87,992
社区成员
发帖
与我相关
我的任务
分享
<!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=UTF-8">
<title>Insert title here</title>
<script language="javascript" type="text/javascript">
function showdiv(num) {
document.getElementById("bg"+num).style.display = "none";
document.getElementById("show"+num).style.display = "block";
}
function hidediv(num) {
document.getElementById("bg"+num).style.display = 'block';
document.getElementById("show"+num).style.display = 'none';
}
</script>
</head>
<body>
<form>
<table border="1">
<?php
$db = mysql_connect('localhost','root','root');
mysql_select_db('ec',$db);
if (!$db)
{
die('Could not connect: ' . mysql_error());
}
$result = mysql_query("select * from goods");
echo "<tr>
<th>GoodsID</th>
<th>BarCode</th>
<th>GoodsName</th>
<th>Category</th>
<th>Specifications</th>
<th>Manufacturers</th>
<th>Numbers</th>
<th>Instructions</th>
<th>Pictures</th>
<th>Update</th>
<th>Delete</th>
</tr>";
$n = 0;
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['id'] . "</td>";
echo "<td>" . $row['barcode'] . "</td>";
echo "<td>" . $row['goods_name'] . "</td>";
echo "<td>" . $row['category'] . "</td>";
echo "<td>" . $row['specifications'] . "</td>";
echo "<td>" . $row['manufacturers'] . "</td>";
echo "<td>" . $row['number'] . "</td>";
echo "<td>" . $row['instruction'] . "</td>";
echo "<td>" . "<img src = '$row[picture_url]' style='width:80px;height=60px'/>" . "</td>";
echo "<td id='bg$n'>".
"<input id='btnshow$n' type='button' value='Show' onclick='showdiv($n)'/>".
"</td>".
"<td id='show$n' style='display:none'>".
"<input id='btnclose$n' type='button' value='Close' onclick='hidediv($n)'/>".
"</td>";
echo "<td>"."<a href='delete.php?id=$row[id]'>"."Delete"."</a>"."</td>";
echo "</tr>";
++$n;
}
mysql_close($db);
?>
</table>
</form>
</body>
</html>
<!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=UTF-8">
<title>Insert title here</title>
<script language="javascript" type="text/javascript">
function showdiv(num) {
document.getElementById("bg"+num).style.display = "none";
document.getElementById("show"+num).style.display = "block";
}
function hidediv(num) {
document.getElementById("bg"+num).style.display = 'block';
document.getElementById("show"+num).style.display = 'none';
}
</script>
</head>
<body>
<form>
<table border="1">
<?php
$db = mysql_connect('localhost','root','root');
mysql_select_db('ec',$db);
if (!$db)
{
die('Could not connect: ' . mysql_error());
}
$result = mysql_query("select * from goods");
echo "<tr>
<th>GoodsID</th>
<th>BarCode</th>
<th>GoodsName</th>
<th>Category</th>
<th>Specifications</th>
<th>Manufacturers</th>
<th>Numbers</th>
<th>Instructions</th>
<th>Pictures</th>
<th>Update</th>
<th>Delete</th>
</tr>";
$n = 0;
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['id'] . "</td>";
echo "<td>" . $row['barcode'] . "</td>";
echo "<td>" . $row['goods_name'] . "</td>";
echo "<td>" . $row['category'] . "</td>";
echo "<td>" . $row['specifications'] . "</td>";
echo "<td>" . $row['manufacturers'] . "</td>";
echo "<td>" . $row['number'] . "</td>";
echo "<td>" . $row['instruction'] . "</td>";
echo "<td>" . "<img src = '$row[picture_url]' style='width:80px;height=60px'/>" . "</td>";
echo "<td id='bg$n'>".
"<input id='btnshow$n' type='button' value='Show' onclick='showdiv($n)'/>".
"</td>".
"<td id='show$n' style='display:none'>".
"<input id='btnclose$n' type='button' value='Close' onclick='hidediv($n)'/>".
"</td>";
echo "<td>"."<a href='delete.php?id=$row[id]'>"."Delete"."</a>"."</td>";
echo "</tr>";
}
mysql_close($db);
?>
</table>
</form>
</body>
</html>
<!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=UTF-8">
<title>Insert title here</title>
<script language="javascript" type="text/javascript">
function showdiv(num) {
document.getElementById("bg"+num).style.display = "none";
document.getElementById("show"+num).style.display = "block";
}
function hidediv(num) {
document.getElementById("bg"+num).style.display = 'block';
document.getElementById("show"+num).style.display = 'none';
}
</script>
</head>
<body>
<form>
<table border="1">
<?php
$db = mysql_connect('localhost','root','root');
mysql_select_db('ec',$db);
if (!$db)
{
die('Could not connect: ' . mysql_error());
}
$result = mysql_query("select * from goods");
echo "<tr>
<th>GoodsID</th>
<th>BarCode</th>
<th>GoodsName</th>
<th>Category</th>
<th>Specifications</th>
<th>Manufacturers</th>
<th>Numbers</th>
<th>Instructions</th>
<th>Pictures</th>
<th>Update</th>
<th>Delete</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['id'] . "</td>";
echo "<td>" . $row['barcode'] . "</td>";
echo "<td>" . $row['goods_name'] . "</td>";
echo "<td>" . $row['category'] . "</td>";
echo "<td>" . $row['specifications'] . "</td>";
echo "<td>" . $row['manufacturers'] . "</td>";
echo "<td>" . $row['number'] . "</td>";
echo "<td>" . $row['instruction'] . "</td>";
echo "<td>" . "<img src = '$row[picture_url]' style='width:80px;height=60px'/>" . "</td>";
echo "<td id='bg0'>".
"<input id='btnshow0' type='button' value='Show' onclick='showdiv(0)'/>".
"</td>".
"<td id='show0' style='display:none'>".
"<input id='btnclose0' type='button' value='Close' onclick='hidediv(0)'/>".
"</td>";
echo "<td>"."<a href='delete.php?id=$row[id]'>"."Delete"."</a>"."</td>";
echo "</tr>";
}
mysql_close($db);
?>
</table>
</form>
</body>
</html>
不好使啊,麻烦帮我看看。