There's no error, except that when I click "Yes" (as in Yes I want to delete the page), there is a page saying that page cannot be found (
http://localhost/%3Cbr%20/%3E%3Cb%3E...br%20/%3E&do=1)
THIS CODES IS DIRECTLY FROM THE DOWNLOADED ZIP FILE:
<?php
$link = mysql_connect("localhost", "root", "")
or die("Could not connect: " . mysql_error());
mysql_select_db('chapter6', $link) or die ( mysql_error());
// DELETE SCRIPT
if ( !isset( $_GET['do'] ) || $_GET['do'] != 1 ){
?>
<p align="center" style="color:#FF0000">
Are you sure you want to delete this <?php echo $_GET['type']?>?<br/>
<a href="<?php echo $_SERVER['REQUEST_URI']?>&do=1">yes</a> or <a
href="index.php">Index</a>
</p>
<?php
} else {
if ( $_GET['type'] == "people" ){
// delete references to people from the movie table
// delete reference to lead actor
$actor = "UPDATE
`movie`
SET
`movie_leadactor` = '0'
WHERE
`movie_leadactor` = '".$_GET['id']."'
";
$result = mysql_query( $actor )
or die("Invalid query: " . mysql_error());
// delete reference to director
$director = "UPDATE
`movie`
SET
`movie_director` = '0'
WHERE
`movie_director` = '".$_GET['id']."'
";
$result = mysql_query( $director )
or die("Invalid query: " . mysql_error());
}
// generate SQL
$sql = "DELETE FROM
`".$_GET['type']."`
WHERE
`".$_GET['type']."_id` = '".$_GET['id']."'
LIMIT 1";
// echo SQL for debug purpose
echo "";
$result = mysql_query( $sql )
or die("Invalid query: " . mysql_error());
?>
<p align="center" style="color:#FF0000">
Your <?php echo $_GET['type']?> has been deleted. <a href="index.php">Index</a>
</p>
<?php
}
?>