Jump to content

[SOLVED] dreamweaver cs4 php code errors


phpuser1985

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

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.