Hello,
I'm trying to adopt a script I have found in a book I am using that deletes a customers account.
I am currently getting this error:
Parse error: syntax error, unexpected T_IF in C:\xampplite\htdocs\website\delete_account.php on line 10
Here is the script:
<?php
// This page deletes the customer account.
$problem = FALSE; // Assume no problem.
// Start the PHP page.
$page_title = 'Delete Account';
include ('./includes/header.php')
if (isset($_GET['customer_id'])) { // Make sure there's a customer ID.
$customer_id = $_GET['customer_id'];
require_once ('/mysqli_connect.php'); // Connect to the database.
$query = "DELETE FROM customers WHERE customer_id = '$customer_id'";
$result = mysqli_query ($dbc, $query) or die("Error: ".mysqli_error($dbc));
if (mysqli_num_rows($result) == 1) { // Good to go
echo '<div align="center"><font size="+1">The selected customer account has been deleted</font></div>';
} else { // No record returned from the database.
$problem = TRUE;
}
mysqli_close($dbc); // Close the database connection.
} else { // No customer ID.
$problem = TRUE;
}
if ($problem) { // Show an error message.
$page_title = 'Error';
include ('./includes/header.php');
echo '<div align="center"><font size="+1">The account could not be deleted</font></div>';
}
// Complete the page.
include ('./includes/footer.php');
?>
Can anybody help me please? Thank you