php - headers already - Puzzling version - . Works locally, not live -
this question has answer here:
- reference - error mean in php? 29 answers
i aware there should no whitespace before php code. code gives me following error on live server, not on test apache server:
warning: cannot modify header information - headers sent (output started @ /home/mydomain/public_html/parts/includes/dbinfo.inc.php:5) in /home/mydomain/public_html/parts/update_part.php on line 55
i have tried removing functions.inc.php
still getting same problem. below 2 pieces of code involved: a) dbinfo.inc.php
<?php $username="myusername"; $password="mypassword"; $database="mydatabase"; ?>
b) update_part.php
<?php include("./includes/dbinfo.inc.php"); include("./includes/functions.inc.php"); mysql_connect("localhost","$username","$password") or die("error: ".mysqlerror()); mysql_select_db("$database"); //get variables transmitted form $part_id = $_post['part_id']; $part_manufacturer = $_post['part_manufacturer']; $part_descr = $_post['part_descr']; $part_price = $_post['part_price']; $part_code = $_post['part_code']; $part_status = $_post['part_status']; $part_image = $_post['part_image']; $part_cat = $_post['part_cat']; $ave_mth_usage = $_post['ave_mth_usage']; $reorder_level = $_post['reorder_level']; $reorder_qty = $_post['reorder_qty']; $other_item_details = $_post['other_item_details']; $part_stock_taking_date = $_post['part_stock_taking_date']; $part_qty_in_stock = $_post['part_qty_in_stock']; $part_manufacturer = mysql_real_escape_string($part_manufacturer); $part_descr = mysql_real_escape_string($part_descr); $part_code = mysql_real_escape_string($part_code); $part_status = mysql_real_escape_string($part_status); $part_cat = mysql_real_escape_string($part_cat); $other_item_details = mysql_real_escape_string($other_item_details); //replace testtable name of table $sql = "update part set part_manufacturer = '$part_manufacturer', part_descr = '$part_descr', part_price = '$part_price', part_code = '$part_code', part_status = '$part_status', part_image = '$part_image', part_cat = '$part_cat', ave_mth_usage = '$ave_mth_usage', reorder_level = '$reorder_level', reorder_qty = '$reorder_qty', other_item_details = '$other_item_details', part_stock_taking_date = '$part_stock_taking_date', part_qty_in_stock = '$part_qty_in_stock' part_id = $part_id"; //mysql_query($sql) or die ("error: ".mysql_error()); do_query($sql,__line__); header("location: ./view_parts.php"); ?>
the offending code @ line 55 line before final line of b) i.e.
header("location: ./view_parts.php");
any ideas?
you should delete php closing tag php script , spaces before opening tag , again in included php scripts
Comments
Post a Comment