Jump to content

Delete record page not working


Zergman

Recommended Posts

So i've used Dreamweaver to help with this task but have left it behind since its not working.

 

I retrieve my record to delete and pass it to the delete page using

<a href="tracker_del.php?recordID=<?php echo $row_rsdatadisplay['id']; ?>">Del</a>

 

On tracker_del.php, I have this

<?php session_start(); ?>
<?php require_once('Connections/cntrackanator.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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['hiddendelete'])) && ($_GET['hiddendelete'] != "")) {
  $deleteSQL = sprintf("DELETE FROM ``data`` WHERE id=%s",
                       GetSQLValueString($_GET['hiddendelete'], "int"));

  mysql_select_db($database_cntrackanator, $cntrackanator);
  $Result1 = mysql_query($deleteSQL, $cntrackanator) or die(mysql_error());

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

$colname_rsdelete = "-1";
if (isset($_GET['recordID'])) {
  $colname_rsdelete = $_GET['recordID'];
}
mysql_select_db($database_cntrackanator, $cntrackanator);
$query_rsdelete = sprintf("SELECT * FROM `data` WHERE id = %s", GetSQLValueString($colname_rsdelete, "int"));
$rsdelete = mysql_query($query_rsdelete, $cntrackanator) or die(mysql_error());
$row_rsdelete = mysql_fetch_assoc($rsdelete);
$totalRows_rsdelete = mysql_num_rows($rsdelete);
?>

 

And my form

<body>
<form action="" method="post" name="form1" id="form1">
  <input name="hiddendelete" type="hidden" id="hiddendelete" value="<?php echo $row_rsdelete['id']; ?>" />
  Delete <?php echo $row_rsdelete['stn']; ?> ? 
  <label>
  <input type="submit" name="button" id="button" value="Submit" />
</label>
</form>
</body>

 

When I click the submit button, nothing happens.  Record does not delete and I just stay on the delete page.

 

Help?

Link to comment
https://forums.phpfreaks.com/topic/115985-delete-record-page-not-working/
Share on other sites

i would delete the contents of the delete page and try again. are you using the delete wizard?

 

if you want to message me via yahoo, msn or icq i can walk you through this, in a good 5 minutes.

 

yahoo: [email protected]

 

msn: [email protected]

 

ICQ: 465087281

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.