 |
|
*** จริงๆใช้ คำสั่งรีเฟสไปหน้าอื่นก็ได้นะครับ แต่ว่าตอนนี้มันเป็นกับทั้งเว็บเลย ถ้าจะแก้เยอะมาก ทำไงดีครับ**
ขึ้น error ว่า
Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\pronthep\Connections\conn.php:1) in C:\AppServ\www\pronthep\addmem.php on line 57
บรรทัดนั้นก็คือ
Code
$insertGoTo = "member_suc.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo)); <<<<<<<<< line 57
นี้อ่ะครับ งงเลย ทั้ง ๆ ที่ก็ทำอย่างงี้มาตลอด แต่คราวนี้ ดันเป็นงี้ ไม่ทราบว่าเป็นที่จุด ๆ ไหนครับ คร่าว ๆ มาก็ได้ครับ
(ข้อมูลที่พิมพ์ไป เข้าปกตินะครับ)
อัพเดทหน่อยครับ ผมเพิ่งเช็คทั้งหมดเว็บ ปรากฏว่า ทุกส่วนของเว็บ ถ้าเพิ่มข้อมูลลง ฐานข้อมูล จะ error แบบเดียวกันหมดเลยครับ
ทำไงดีครับ ขอบคุณมากครับ
อันนี้ โค้ดในการเพิ่มข้อมูลครับ (ใช้วิซาดของดรีม ซึ่งปกติก็ใช้ได้)
Code (PHP)
<?php require_once('Connections/conn.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;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO member (mem_user, mem_pass, mem_name, mem_email, mem_status, mem_active, mem_date) VALUES (%s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['mem_user'], "text"),
GetSQLValueString($_POST['mem_pass'], "text"),
GetSQLValueString($_POST['mem_name'], "text"),
GetSQLValueString($_POST['mem_email'], "text"),
GetSQLValueString($_POST['mem_status'], "text"),
GetSQLValueString($_POST['mem_active'], "text"),
GetSQLValueString($_POST['mem_date'], "date"));
mysql_select_db($database_conn, $conn);
$Result1 = mysql_query($insertSQL, $conn) or die(mysql_error());
$insertGoTo = "member_suc.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
Tag : PHP, MySQL, HTML/CSS, CakePHP
|
ประวัติการแก้ไข 2013-12-08 15:38:39 2013-12-08 15:40:49 2013-12-08 15:45:19 2013-12-08 16:26:52
|
 |
 |
 |
 |
Date :
2013-12-08 15:16:23 |
By :
benzsara |
View :
1508 |
Reply :
9 |
|
 |
 |
 |
 |
|
|
|
 |