数据库删除操作2
2016-06-27 18:49
253 查看
/*deal_edit.php*/ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>编辑处理</title> </head> <body> <?php include_once"connect.php"; $id=$_POST['id']; //接受从编辑界面传过来的值。 $name=$_POST['name']; $sex=$_POST['sex']; $age=$_POST['age']; if($_GET['ud']) { $ud=$_GET['ud']; $sql="select * from stu where stu_id=$ud";//从数据库中选择将要编辑的学生信息。 $re=mysql_query($sql) or die(mysql_error()); if(!mysql_num_rows($re)) { echo "ID wrong"; } $row=mysql_fetch_array($re); if(!empty($name)||trim($name)!='') //判断姓名是否为空 { $sql="update stu set stu_name='".$name."',stu_id='".$id."',stu_age='".$age."',stu_sex='".$sex."' where stu_id=$id"; mysql_query($sql) or die(mysql_error()); // echo "<center>"; // echo "Edit success!"; // echo '<a href="sy.php"><input name="return" type="button" value="return" ></a>'; // echo "</center>"; header('location:table.php'); mysql_close($conn); } } else { echo "fail to delete!"; mysql_error(); } ?> </body> </html>
相关文章推荐
- sqlite交叉编译
- 数据库编辑操作
- 数据库添加数据I
- mysql auto_increment 初始值从0开始
- mysql 主从复制
- MongoDB 几个小命令
- php CI框架中调用接口 memcache缓存数据
- 数据库删除操作
- Hive-0.13.1本地独立模式安装 元数据存储到MariaDB-10.1.0 Hadoop-2.4.0
- 数据库操作
- oracle
- 【Mysql】mysql查询超时JDBC源码浅析
- jsp中使用动态数据进行mySQL数据库的两种操作方法
- mysqldump和mydumper的比较
- MYSQL性能查看(命中率,慢查询)
- 数据库事务的理解
- TimesTen 数据库复制学习:8. 管理Active Standby Pair(带缓存组)
- MySQL 索引分析
- window下mysql安装以及问题解决方法
- myBatis数据库连接配置错误