-3

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');
     }
 } 
mickmackusa
  • 43,625
  • 12
  • 83
  • 136
  • Both of your queries are not secure because you are feeding unsanitized values to them. Please research prepared statements with placeholders for security reasons ASAP. You didn't close your if condition. This question is Off-topic: Typo. I have voted to close. You are welcome to remove your question if you like because your question will likely only catch downvotes, before being closed and deleted by the community. – mickmackusa May 05 '18 at 11:46

1 Answers1

0

Like the error says, the curly bracket on line 4 was not expected. This is because of an omitted parenthese on line 3:

 if (isset($_POST['passbookid'])

should be

 if (isset($_POST['passbookid']))

same on line 13:

if (isset($_POST['userid']))
Jonan
  • 2,485
  • 3
  • 24
  • 42
  • 2
    When the answer is "add one missing parenthesis", there is no need to answer. Just leave a comment under the question and flag/vote to close as Off-topic: Typo. This page will be quickly scrubbed from the site (as will any upvote points you receive) because this page is completely useless to researchers. – mickmackusa May 05 '18 at 11:42