Wrox Programmer Forums
|
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 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 29th, 2004, 01:32 PM
Registered User
 
Join Date: Nov 2004
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));
}
?>






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 01:55 PM
how about cancel a process kevsboy Beginning VB 6 0 February 12th, 2006 11: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





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