Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Dreamweaver MX: PHP Web Development
This is the forum to discuss the Wrox book Dreamweaver MX: PHP Web Development by Gareth Downes-Powell, Tim Green, Bruno Mairlot; ISBN: 9780764543876
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Dreamweaver MX: PHP Web Development 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 Display Modes
  #1 (permalink)  
Old November 29th, 2004, 12:32 PM
Registered User
 
Join Date: Nov 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Cancel Booking



Hi folks,

I am having a problem getting this to work (obviously,or I wouldn't be here ;). The 'cancel_booking.php' site eats the booking number and reloads. It doesn't even have the decency of deleting the record!?!

Any help would ge greatly appreciated.

Here is the code:

<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}

if ((isset($_GET['bookingID'])) && ($_GET['bookingID'] != "") && (isset($_POST['bookingID']))) {
  $deleteSQL = sprintf("DELETE FROM bookings WHERE ID=%s",
                       GetSQLValueString($_GET['bookingID'], "int"));

  mysql_select_db($database_rsBooking, $rsBooking);
  $Result1 = mysql_query($deleteSQL, $rsBooking) or die(mysql_error());

  $deleteGoTo = "booking_cancelled.php?bookingID=".$_POST_VARS['bookingID']."";
  if (isset($_SERVER['QUERY_STRING'])) {
    $deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
    $deleteGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $deleteGoTo));
}
?>

Reply With Quote
Reply


Thread Tools
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
cancel appointment jeanhl BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 3 March 25th, 2008 03:55 AM
How can I cancel deleting ? ALGNET ADO.NET 1 March 22nd, 2006 12:55 PM
how about cancel a process kevsboy Beginning VB 6 0 February 12th, 2006 10:03 PM
Help me ! Cancel Update Error ! minhtri Pro VB Databases 0 August 28th, 2004 09:03 PM
Cancel a keystroke Kenny Alligood Access 4 June 12th, 2003 10:02 AM



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


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