php显示页面后面加编辑和删除按钮,可以编辑和删除每行的信息
<?php@header('Content-type:text/html;charset=UTF-8');require_once'conn.php';require_o...
<?php @header('Content-type: text/html;charset=UTF-8');
require_once 'conn.php';
require_once("SubPages.php");
//每次显示的页数
$sub_pages=10;
//每页显示的条数
$page_size=100;
//得到当前是第几页
@$pageCurrent=$_GET['p'];
if(!$pageCurrent) $pageCurrent=1;
//连接数据库
$db=new MySql("localhost","root","","test");
if(isset($_POST['sub']) && !empty($_POST['search'])){
$search=trim($_POST['search']);
$sql="select * from custominfo where pingjia Like '%$search%'";
$query=$db->query($sql);
$nums=$db->num_rows($query);
$sql="select * from custominfo where pingjia Like '%$search%' order by id limit ".($pageCurrent - 1) * $page_size.",$page_size";
$query=$db->query($sql);
}else{
$sql="select * from custominfo";
$query=$db->query($sql);
//总条目数
$nums=$db->num_rows($query);
$sql="select * from custominfo order by id limit ".($pageCurrent - 1) * $page_size.",$page_size";
$query=$db->query($sql);
}
?>
<center><font size="20">客户资料存储中心</font></center>
<a href="addcustominfo.php">添加客户信息</a>
<hr size="6" color="#ff0000"/>
<form name="frmsearch" action="" method="POST">
<input type="hidden" name="id" id="id" value="22"/>
<table width="90%" border="1" align="center">
<tbody>
<tr>
<td colspan=6 align="right">
<input type="text" align="right" name="search" id="search"></input>
</td>
<td>
<input type="submit" name="sub" value="产品评价查询" align="right"></input>
</td>
</tr>
</tbody>
</table>
</form>
<table width="90%" border="1" bordercolor="#260000" align="center">
<tbody>
<tr>
<th>客户评价</th>
</tr>
<?php
while($row=$db->fetch_array($query)){
?>
<tr>
<td>
<?php
if(empty($row['pingjia'])){
echo("无");
}else{
echo($row['pingjia']);
}
?>
</td>
<td> echo '<a href="customlist.php?act=delete&id='.$row['id'].'" onClick="return confirm('确定删除吗?');">删除</a>';
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<table width="80%" border="0" align="center">
<tbody>
<tr>
<td colspan=7 align="right">
<?php
$subPages=new SubPages($page_size,$nums,$pageCurrent,$sub_pages,"customlist.php?p=",2);
?>
</td>
</tr>
</tbody>
</table>
20分全部贡献了,求修改后的代码 展开
require_once 'conn.php';
require_once("SubPages.php");
//每次显示的页数
$sub_pages=10;
//每页显示的条数
$page_size=100;
//得到当前是第几页
@$pageCurrent=$_GET['p'];
if(!$pageCurrent) $pageCurrent=1;
//连接数据库
$db=new MySql("localhost","root","","test");
if(isset($_POST['sub']) && !empty($_POST['search'])){
$search=trim($_POST['search']);
$sql="select * from custominfo where pingjia Like '%$search%'";
$query=$db->query($sql);
$nums=$db->num_rows($query);
$sql="select * from custominfo where pingjia Like '%$search%' order by id limit ".($pageCurrent - 1) * $page_size.",$page_size";
$query=$db->query($sql);
}else{
$sql="select * from custominfo";
$query=$db->query($sql);
//总条目数
$nums=$db->num_rows($query);
$sql="select * from custominfo order by id limit ".($pageCurrent - 1) * $page_size.",$page_size";
$query=$db->query($sql);
}
?>
<center><font size="20">客户资料存储中心</font></center>
<a href="addcustominfo.php">添加客户信息</a>
<hr size="6" color="#ff0000"/>
<form name="frmsearch" action="" method="POST">
<input type="hidden" name="id" id="id" value="22"/>
<table width="90%" border="1" align="center">
<tbody>
<tr>
<td colspan=6 align="right">
<input type="text" align="right" name="search" id="search"></input>
</td>
<td>
<input type="submit" name="sub" value="产品评价查询" align="right"></input>
</td>
</tr>
</tbody>
</table>
</form>
<table width="90%" border="1" bordercolor="#260000" align="center">
<tbody>
<tr>
<th>客户评价</th>
</tr>
<?php
while($row=$db->fetch_array($query)){
?>
<tr>
<td>
<?php
if(empty($row['pingjia'])){
echo("无");
}else{
echo($row['pingjia']);
}
?>
</td>
<td> echo '<a href="customlist.php?act=delete&id='.$row['id'].'" onClick="return confirm('确定删除吗?');">删除</a>';
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<table width="80%" border="0" align="center">
<tbody>
<tr>
<td colspan=7 align="right">
<?php
$subPages=new SubPages($page_size,$nums,$pageCurrent,$sub_pages,"customlist.php?p=",2);
?>
</td>
</tr>
</tbody>
</table>
20分全部贡献了,求修改后的代码 展开
1个回答
展开全部
<?php
@header('Content-type: text/html;charset=UTF-8');
require_once 'conn.php';
require_once("SubPages.php");
//每次显示的页数
$sub_pages=10;
//每页显示的条数
$page_size=100;
//得到当前是第几页
@$pageCurrent=$_GET['p'];
if(!$pageCurrent) $pageCurrent=1;
//连接数据库
$db=new MySql("localhost","root","","test");
if(isset($_POST['sub']) && !empty($_POST['search'])){
$search=trim($_POST['search']);
$sql="select * from custominfo where pingjia Like '%$search%'";
$query=$db->query($sql);
$nums=$db->num_rows($query);
$sql="select * from custominfo where pingjia Like '%$search%' order by id limit ".($pageCurrent - 1) * $page_size.",$page_size";
$query=$db->query($sql);
}else{
$sql="select * from custominfo";
$query=$db->query($sql);
//总条目数
$nums=$db->num_rows($query);
$sql="select * from custominfo order by id limit ".($pageCurrent - 1) * $page_size.",$page_size";
$query=$db->query($sql);
}
?>
<center><font size="20">客户资料存储中心</font></center>
<a href="addcustominfo.php">添加客户信息</a>
<hr size="6" color="#ff0000"/>
<form name="frmsearch" action="" method="POST">
<input type="hidden" name="id" id="id" value="22"/>
<table width="90%" border="1" align="center">
<tbody>
<tr>
<td colspan=6 align="right">
<input type="text" align="right" name="search" id="search"></input>
</td>
<td>
<input type="submit" name="sub" value="产品评价查询" align="right"></input>
</td>
</tr>
</tbody>
</table>
</form>
<table width="90%" border="1" bordercolor="#260000" align="center">
<tbody>
<tr>
<th>客户评价</th>
<th>删除</th>
<th>修改</th>
</tr>
<?php
while($row=$db->fetch_array($query)){
?>
<tr>
<td>
<?php
if(empty($row['pingjia'])){
echo("无");
}else{
echo($row['pingjia']);
}
?>
</td>
<td> <a href="customlist.php?act=delete&id=<?php echo $row['id'];?>" onClick="return confirm('确定删除吗?');">删除</a>
</td> <td><a href="customlist.php?act=update&id=<?php echo $row['id'];?>">修改</a></td>
</tr>
<?php
}
?>
</tbody>
</table>
<table width="80%" border="0" align="center">
<tbody>
<tr>
<td colspan=7 align="right">
<?php
$subPages=new SubPages($page_size,$nums,$pageCurrent,$sub_pages,"customlist.php?p=",2);
?>
</td>
</tr>
</tbody>
</table>
@header('Content-type: text/html;charset=UTF-8');
require_once 'conn.php';
require_once("SubPages.php");
//每次显示的页数
$sub_pages=10;
//每页显示的条数
$page_size=100;
//得到当前是第几页
@$pageCurrent=$_GET['p'];
if(!$pageCurrent) $pageCurrent=1;
//连接数据库
$db=new MySql("localhost","root","","test");
if(isset($_POST['sub']) && !empty($_POST['search'])){
$search=trim($_POST['search']);
$sql="select * from custominfo where pingjia Like '%$search%'";
$query=$db->query($sql);
$nums=$db->num_rows($query);
$sql="select * from custominfo where pingjia Like '%$search%' order by id limit ".($pageCurrent - 1) * $page_size.",$page_size";
$query=$db->query($sql);
}else{
$sql="select * from custominfo";
$query=$db->query($sql);
//总条目数
$nums=$db->num_rows($query);
$sql="select * from custominfo order by id limit ".($pageCurrent - 1) * $page_size.",$page_size";
$query=$db->query($sql);
}
?>
<center><font size="20">客户资料存储中心</font></center>
<a href="addcustominfo.php">添加客户信息</a>
<hr size="6" color="#ff0000"/>
<form name="frmsearch" action="" method="POST">
<input type="hidden" name="id" id="id" value="22"/>
<table width="90%" border="1" align="center">
<tbody>
<tr>
<td colspan=6 align="right">
<input type="text" align="right" name="search" id="search"></input>
</td>
<td>
<input type="submit" name="sub" value="产品评价查询" align="right"></input>
</td>
</tr>
</tbody>
</table>
</form>
<table width="90%" border="1" bordercolor="#260000" align="center">
<tbody>
<tr>
<th>客户评价</th>
<th>删除</th>
<th>修改</th>
</tr>
<?php
while($row=$db->fetch_array($query)){
?>
<tr>
<td>
<?php
if(empty($row['pingjia'])){
echo("无");
}else{
echo($row['pingjia']);
}
?>
</td>
<td> <a href="customlist.php?act=delete&id=<?php echo $row['id'];?>" onClick="return confirm('确定删除吗?');">删除</a>
</td> <td><a href="customlist.php?act=update&id=<?php echo $row['id'];?>">修改</a></td>
</tr>
<?php
}
?>
</tbody>
</table>
<table width="80%" border="0" align="center">
<tbody>
<tr>
<td colspan=7 align="right">
<?php
$subPages=new SubPages($page_size,$nums,$pageCurrent,$sub_pages,"customlist.php?p=",2);
?>
</td>
</tr>
</tbody>
</table>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询