Wrox Programmer Forums
|
BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0
This is the forum to discuss the Wrox book Beginning PHP5, Apache, and MySQL Web Development by Elizabeth Naramore, Jason Gerner, Yann Le Scouarnec, Jeremy Stolz, Michael K. Glass; ISBN: 9780764579660
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 6th, 2006, 12:08 PM
Registered User
 
Join Date: Nov 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default chapter 6 deleting a record problem

<?php
$link = mysql_connect("localhost", "bp5am", "bp5ampass")
    or die("Could not connect: " . mysql_error());
mysql_select_db('moviesite', $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
}
?>


when i open the index.php file and select delete ,i get a screen asking if i want delete the movie. when i click yes, i get a page not available error. the link it points to is ,

http://www.worldofpakistan.net/phpfi...ie/chap6/&do=1


please help me im desperate





Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting a record from a subform captainlove Access VBA 3 May 1st, 2008 11:38 AM
Deleting A Record sirmilt BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 1 July 31st, 2006 07:12 PM
Deleting a Record pg. 178 Chapter 6 Mantis_Atlantis BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 2 March 13th, 2006 02:26 PM
Confirm before deleting record jgrasso BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 March 30th, 2005 12:03 PM
Deleting a record AND the images? jonpanky MySQL 0 January 4th, 2005 12:13 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.