PHP develops simple book borrowing system and complete book borrowing function implementation code
Introduce the database file config.php
Create a complete book borrowing code file jieshu.php.
借书功能页 alert('编号不正确');window.location='index.php'"; exit(); } else { ?> alert('您还没有登陆');window.location='landing.php'"; exit(); }else{ // 可以正常借书,记录之 // 获得当前日期 $now = date("Y-m-d,H-i-m"); $lendsql="INSERT INTO lend(book_id, book_title, lend_time, user_id) values('$book_id','$title','$now','".$_SESSION['id']."')"; mysqli_query($link,$lendsql); // 借出后需要在该书记录中库存剩余数减一 mysqli_query($link,"update yx_books set leave_number=leave_number-1 where id='$book_id'"); echo ""; ?>