gpt4 book ai didi

php - 标题已经 - 令人费解的版本 - 。在本地工作,不在现场

转载 作者:行者123 更新时间:2023-11-29 04:43:48 25 4
gpt4 key购买 nike

<分区>

我知道在 php 代码之前不应该有空格。然而,我的代码在实时服务器上给我以下错误,但在我的测试 Apache 服务器上没有:

Warning: Cannot modify header information - headers already sent by (output started at /home/mydomain/public_html/parts/includes/dbinfo.inc.php:5) in /home/mydomain/public_html/parts/update_part.php on line 55

我已经尝试删除 functions.inc.php 仍然遇到同样的问题。 以下是涉及的两段代码:a) 数据库信息.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 the variables we transmitted from the 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 with the name of your 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'


WHERE part_id = $part_id";
//mysql_query($sql) or die ("Error: ".mysql_error());
do_query($sql,__LINE__);
header("Location: ./view_parts.php");
?>

第 55 行的违规代码是 b) 最后一行之前的行,即

header("Location: ./view_parts.php");

有什么想法吗?

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com