this question has answer here:
- reference - error mean in php? 30 answers
getting error php parse error: syntax error, unexpected end of file in c:\inetpub\vhosts\mysite.com\subdomains\login\public\helpdesk\deleteproduct.php on line 41
<?php // connect database $servername = "localhost"; $username = "username"; $password = "password"; $dbname = "database"; $conn = new mysqli($servername, $username, $password, $dbname); if ($conn->connect_error) { die("connection failed: " . $conn->connect_error); // confirm 'id' variable has been set if (isset($_get['id']) && is_numeric($_get['id'])) { // 'id' variable url $id = $_get['id']; // delete record database if ($stmt = $mysqli->prepare("delete product id = ? limit 1")) { $stmt->bind_param("i",$id); $stmt->execute(); $stmt->close(); } else { echo "error: not prepare sql statement."; } $mysqli->close(); // redirect user after delete successful header("location:javascript://history.go(-2)"); } else // if 'id' variable isn't set, redirect user { header("location:javascript://history.go(-1)"); } ?>
add ending brace:
if ($conn->connect_error) { die("connection failed: " . $conn->connect_error); }
Comments
Post a Comment