<form id="form2" name="form2" method="post" action="">
<table width="1089" border="1">
<tr>
<td width="65">编号</td>
<td width="306">产品名</td>
<td width="696"> </td>
</tr>
<tr>
<?php do { ?>
<tr><td><label><?php echo $row_Recordset1['c_id']; ?></label></td>
<td><a href="../../../..//home/zhu/xz/xinxiangmu/xianshi.php"><?php echo $row_Recordset1['c_name']; ?></a></td>
<td><label></label>
<label></label>
<label><a href='tianjia.php'>添加 <a href="../../../..//home/zhu/xz/xinxiangmu/delete.php">删除</label></td></tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?></tr>
</table>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, 0, $queryString_Recordset1); ?>">第一页</a>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, max(0, $pageNum_Recordset1 - 1), $queryString_Recordset1); ?>">前一页</a>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, min($totalPages_Recordset1, $pageNum_Recordset1 + 1), $queryString_Recordset1); ?>">下一页</a>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, $totalPages_Recordset1, $queryString_Recordset1); ?>">最后一页</a>
</form>
我想要点击产品名跳转到xianshi.php显示这个产品的全部信息应该如何写xianshi.php啊?这个值如何传过去!
<table width="1089" border="1">
<tr>
<td width="65">编号</td>
<td width="306">产品名</td>
<td width="696"> </td>
</tr>
<tr>
<?php do { ?>
<tr><td><label><?php echo $row_Recordset1['c_id']; ?></label></td>
<td><a href="../../../..//home/zhu/xz/xinxiangmu/xianshi.php"><?php echo $row_Recordset1['c_name']; ?></a></td>
<td><label></label>
<label></label>
<label><a href='tianjia.php'>添加 <a href="../../../..//home/zhu/xz/xinxiangmu/delete.php">删除</label></td></tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?></tr>
</table>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, 0, $queryString_Recordset1); ?>">第一页</a>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, max(0, $pageNum_Recordset1 - 1), $queryString_Recordset1); ?>">前一页</a>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, min($totalPages_Recordset1, $pageNum_Recordset1 + 1), $queryString_Recordset1); ?>">下一页</a>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, $totalPages_Recordset1, $queryString_Recordset1); ?>">最后一页</a>
</form>
我想要点击产品名跳转到xianshi.php显示这个产品的全部信息应该如何写xianshi.php啊?这个值如何传过去!
html产品名那一行改成这样
<td width="306"><a href="xianshi.php?产品名">产品名</a></td>xianshi.php
<?
$name=$_GET['产品名'];/**
* 查数据库
* 返回产品的详细信息
*/
$db=mysql_connect();
mysql_select_db();
mysql_query('set names utf8');
$res=mysql_query();
$inf=mysql_fetch_array($res);//按需要的格式打印产品信息?>
html产品名那一行改成这样
<td width="306"><a href="xianshi.php?name='参数'">产品名</a></td>
ps:你只需要传过去一个可以定位的字段就可以了,比如说id,比如说name,或者别的,只要能够在数据库中查到他就ok了,最简单就传个id就好,你那个产品名那里我貌似看错了,原来是个导航栏,你在输出产品名的地方做个链接把id或name传过去就好了,那边在查库就哦了
<?php
$db_server="localhost";
$db_user_name="mydb";
$db_user_password="123456";
$db_name="xzdb";
$conn=mysql_connect($db_server,$db_user_name,$db_user_password);
mysql_query("SET NAMES 'GBK'");
$eventid=$_GET['id'];
$sql="delete from chanpinbiao where c_id='$eventid'";
$query=mysql_query($sql,$conn);
echo $query;
$affected=mysql_affected_rows();/*if($affected>0)
{
echo "<script>alert('delete success!!');window.location.href='shouye.php'</script>";
}
else
{
echo "<script>alert('delete failure!!');window.location.href='shouye.php'</script>";
}*/
?>为什么这个sql不会执行,数据库里不能删除啊!
没用上?加在connect之后
mysql_select_db($db_name);