doukun1450 2018-05-05 10:34
浏览 62

无法在Mysql数据库中删除或插入数据[重复]

This question already has an answer here:

This is the adminuses.php I am trying to insert and delete data from the database. It shows the following error.

Parse error: syntax error, unexpected '{' in C:\xampp\htdocs\Library Management\adminuses.php on line 4

adminuses.php

<?php
include ("connection.php");
 if (isset($_POST['passbookid'])
 {
     $id= $_POST['passbookid'];
     $query= "delete from passbook where pid ='".$id."'";
     $result = mysqli_query($sql, $query);
     if ($result)
     {
         header('location:adminlogin.php');
     }
 } 
</div>
  • 写回答

2条回答 默认 最新

  • douliao1911 2018-05-05 10:36
    关注

    You forgot a )

    <?php
    include ("connection.php");
     if (isset($_POST['passbookid']))
     {
         $id= $_POST['passbookid'];
         $query= "delete from passbook where pid ='".$id."'";
         $result = mysqli_query($sql, $query);
         if ($result)
         {
             header('location:adminlogin.php');
         }
     } 
     if (isset($_POST['userid']))
     {
        $id= $_POST['userid'];
        $isbn=$_POST['isbn'];
        $submt=$_POST['submitdate'];
        $issuedt= date("d-m-Y");
        $query= "insert into passbook (user_id, isbn, issuedt, submitdt) values('$id','$isbn','$issuedt','$submt')";
        $result = mysqli_query($sql, $query);
        if ($result)
        {
            header ('location:adminlogin.php');
        }
     }
    
    ?>
    

    Make sure to always check the brackets and curly brackets when you open and close things

    评论

报告相同问题?

悬赏问题

  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计