如何在查询php中添加一个int值(+1)

时间:2017-08-10 13:15:14

标签: php mysqli

我想要+1一个值,因为当我返回这本书时,这个查询将会运行并返回该书,但它不会返回值只是为了帮助我减去书的价值

$id=$_GET['id'];
$book_id = $_GET['book_id'];

if(isset($id)){
   $b=mysqli_query($dbcon, "SELECT * FROM book WHERE book_id='$book_id'");

   $row=mysqli_fetch_array($b);

   $copies=$row['book_copies'];

   $new = $copies++;

   mysqli_query($dbcon,"UPDATE book ON book_copies = $new");    
}

0 个答案:

没有答案