Jump to content

Recommended Posts

im trying to build a delete record behavior but it keeps telling me Warning: Cannot modify header information - headers already

 

sent by (output started at /deleterecord.php:1) in deleterecord.php on line 46. I checked all possible white spacing and have found none. can someone help me out please. thanks.

 

here is the page code:

 

<?php virtual('/Connections/blubeetl.php');?>

<?php

if (!function_exists("GetSQLValueString")) {

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")

{

  if (PHP_VERSION < 6) {

    $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['recordID'])) && ($_GET['recordID'] != "")) {

  $deleteSQL = sprintf("DELETE FROM business WHERE id=%s",

                      GetSQLValueString($_GET['recordID'], "int"));

 

  mysql_select_db($database_blubeetl, $blubeetl);

  $Result1 = mysql_query($deleteSQL, $blubeetl) or die(mysql_error());

 

  $deleteGoTo = "admin/baccounts.php";

  if (isset($_SERVER['QUERY_STRING'])) {

    $deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";

    $deleteGoTo .= $_SERVER['QUERY_STRING'];

  }

  header(sprintf("Location: %s", $deleteGoTo));

}

?>

Link to comment
https://forums.phpfreaks.com/topic/178334-solved-dreamweaver-cs4-php-code-errors/
Share on other sites

Try replacing the header call with a die() call and look at the HTML source and see what character has been output. I'm guessing looking at your code that <?php virtual('/Connections/blubeetl.php');?> is the cause of the problem as their doesn't appear to be a problem anywhere else.

The error states where the output is occuring -

output started at /deleterecord.php:1

Unfortunately, you have a php statement on line one of the posted code, so there are two possibilities. You should actually put the opening <?php tag on a line by itself with noting else on the line with it in order to help eliminate the second reason listed below -

 

1) Your file has been saved in UTF-8 format and the BOM (Byte Order Mark) characters that the editor places at the start of the file IS the content being output on line one.

 

2) Something in the /Connections/blubeetl.php file is causing output to be sent. This could be before the <?php opening tag, in the body of the file, or even after the ?> closing tag.

hi everyone thanks for all the quick replies i appreciate it. i figured it out i think. dreamweaver just ha a glitch where you need to turn (bom) on save your work then turn it off and save. when i do this the errors dissappear and everything works. weird

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.