PHP删除数据库的某一条数据,PHP删除数据库数据问题

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

下面是部分PHP代码,我需要在删除数据后插入多条数据,每条数据中都有student_number,问题好像出在数据删除之后,每次插入一条信息,他就删掉了,最后只剩一条数据了,请大神们帮我看一下

if ( isset($_POST['student_number']) && isset($_POST['book'])&&isset($_POST['author']) &&isset($_POST['borrow_date']) &&

isset($_POST['return_date']) && isset($_POST['location']) && isset($_POST['tiaomahao']) ) {

$student_number=$_POST["student_number"];

$book=$_POST["book"];

$author= $_POST['author'];

$borrow_date=$_POST["borrow_date"];

$return_date=$_POST["return_date"];

$location = $_POST['location'];

$tiaomahao = $_POST['tiaomahao'];

$sql="delete from libraryinfor where student_number ='$student_number'";

$result=mysql_query($sql);

// include db connect class

require_once __DIR__ . '/db_connect.php';

// connecting to db

$db = new DB_CONNECT();

// mysql inserting a new row

$result = mysql_query("INSERT INTO libraryinfor(student_number,book,author,borrow_date,return_date,location,tiaomahao)

VALUES( '$student_number', '$book', '$author','$borrow_date', '$return_date','$location','$tiaomahao')");

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值