Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 23rd, 2004, 03:58 PM
Registered User
 
Join Date: Oct 2004
Location: , , .
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;
?>

Reply With Quote
  #2 (permalink)  
Old November 4th, 2004, 01:33 PM
Authorized User
 
Join Date: Jul 2004
Location: , , .
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.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 02:16 PM.


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