Wrox Programmer Forums
|
BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6
This is the forum to discuss the Wrox book Beginning PHP, Apache, MySQLWeb Development by Michael K. Glass, Yann Le Scouarnec, Elizabeth Naramore, Gary Mailer, Jeremy Stolz, Jason Gerner; ISBN: 9780764557446
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 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 October 23rd, 2004, 03:58 PM
Registered User
 
Join Date: Oct 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Cahpter 13 remove.php

Has anyone gotten this script to work and if so can they tell me what I have to do to get it to work? It just loads as a blank page.

<?php
require('config.php');

$conn = mysql_connect(SQL_HOST, SQL_USER, SQL_PASS)
 or die('Could not connect to MySQL database. ' . mysql_error());

mysql_select_db(SQL_DB,$conn);

if ((isset($_GET['u'])) and (isset($_GET['ml'])))
{
 $sql = "DELETE FROM ml_subscriptions " .
     "WHERE user_id=" . $_GET['u'] .
     " AND ml_id=" . $_GET['ml'];
 $result = mysql_query($sql,$conn);
} else {
 die("Incorrect parameters passed for deletion");
}

if ($result) {
 $msg = "<h2>Removal Successful</h2>";
} else {
 $msg = "<h2>Removal Failed</h2>";
}

$ml_id = $_GET['ml'];
$sql = "SELECT * FROM ml_lists WHERE ml_id = '" . $ml_id . "';";
$result = mysql_query($sql)
 or die('Invalid query: ' . mysql_error());
if (mysql_num_rows($result)) {
 $row = mysql_fetch_array($result);
 $msg .= "You have been removed from the <i>" .
     $row['listname'] . "</i> mailing list.<br />";
} else {
 $msg .= "Sorry, could not find Mailing List id#{$ml_id}");
}

$msg .= "<a href='user.php?u=" . $_GET['u'] .
    "'>Return to Mailing List Signup page</a>";
echo $msg;
?>

 
Old November 4th, 2004, 01:33 PM
Authorized User
 
Join Date: Jul 2004
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I've just knocked one up, it only took minutes to build and get working.
It all works fine.
The only bug that I found, which I corrected during building was the e-mail problem. It needs to be written as email throughout, including in the database.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 13, useraccount.php karlgg BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 4 February 16th, 2010 09:23 AM
Chapter 13: Error in user.php pherank BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 July 4th, 2008 09:09 PM
chapter 13 of php4, user_auth.php Exitus BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 3 August 5th, 2004 09:02 AM
ch 13 enum_options.php not working thurmma BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 3 January 27th, 2004 04:26 AM
13. how can i execute a php script using command l phpsharma BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 3 October 31st, 2003 05:27 AM





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