พี่ที่ฝึกงานให้เขียนโค้ดแก้ไขให้ค่ะ บรรทัดที่ 50-64 หนูเขียนเอง พอรันแล้วมันขึ้น error บรรทัดที่ 40 ค่ะ หนูจะเขียนแก้โค้ดยังไงค่ะ
ไม่จับใส่ tag php หล่ะครับ
Error ว่ายังไง copy มาด้วยครับ
Code (PHP)
<?php require_once('Connections/MCCBB_Record.php'); ?>
<?php
session_start();
if(!isset($_SESSION["MM_Username"])){
header("Location: login.php");
}elseif(($MM_UserGroup == "USER")||($MM_UserGroup == "ADMIN")){
include('checkdate.inc');
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;
}
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" />
<title>แก้ไข MWO ใหม่</title>
<link href="web_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
>?
$cust_ID=$_GET["MWO_No "];
$sql="select * from mwo Where MWO_No ='$MWO_No' ";
$result=mysql_query($sql);
$num_rows = mysql_num_rows($result);
f($num_rows>0){
$rs = mysql_fetch_array($result);
$MWO_No= $rs["MWO_No"];
$Desc_MWO = $rs["Desc_MWO "];
$cust_add= $rs["cust_address"];
$Add_Date = $rs["Add_Date "];
$MM_Username = $rs["MM_Username"];
$Comment_Accept =$rs["Comment_Accept "];
}//end if
?>
<style type="text/css">
<!--
body {
background-color: #F93;
}
-->
</style>
<form method="POST" name="form1" action="<?php echo $editFormAction; ?>">
<h3 align="center" class="head1">แก้ไข MWO ใหม่</h3>
<?php if(!$Result1){?>
<table border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#000000">
<tr>
<td bgcolor="#EEEEEE">
<table align="center" cellspacing="1">
<tr valign="baseline">
<td align="right" valign="middle" nowrap class="style3"><strong class="style3">MWO:</strong></td>
<td><input name="MWO_No" type="text" id="MWO_No" value="<?php echo $_POST['MWO_No'];?>" size="50"></td>
</tr>
<tr valign="baseline">
<td align="right" valign="middle" nowrap="nowrap" class="style1">คำอธิบาย:</td>
<td><input name="Desc_MWO" type="text" id="Desc_MWO" value="<?php echo $_POST['Desc_MWO'];?>" size="50" /></td>
</tr>
<tr valign="baseline">
<td align="right" valign="middle" nowrap class="style1">วันที่เพิ่มงาน:</td>
<td><input name="Add_Date" type="text" id="Add_Date" value="<?php echo $date;?>" size="10" maxlength="10" readonly></td>
</tr>
<tr valign="baseline">
<td align="right" valign="middle" nowrap class="style3"><strong>ผู้บันทึก:</strong></td>
<td><input name="Owner_MWO" type="text" id="Owner_MWO" value="<?php echo $_SESSION["MM_Username"];?>" size="10" readonly></td>
</tr>
<tr valign="baseline">
<td align="right" valign="middle" nowrap class="style1">หมายเหตุ:</td>
<td><label>
<textarea name="Comment" cols="50" rows="5" id="Comment"></textarea>
</label></td>
</tr>
<tr valign="baseline">
<td colspan="2" align="right" nowrap><div align="center">
<input type="submit" value="บันทึก">
<input type="reset" name="Reset" value="Reset">
</div></td>
</tr>
</table>
</td></tr></table>
<input type="hidden" name="MM_insert" value="form1">
<?php }else{ include ('show_new_mwo.php');} //if(!$Result1){?>
</form>
<?
}else{
?>
<div align="center"><span class="style3">คุณไม่มีสิทธิ์ในการใช้หน้านี้</span></div>
<? }?>
</body>
</html>
ประวัติการแก้ไข 2012-03-26 11:08:19
Date :
2012-03-26 11:06:57
By :
mangkunzo
Date :
2012-03-26 11:07:27
By :
piew
ขึ้นerror แบบนี้ค่ะ Parse error: syntax error, unexpected '<' in D:\UBNWEB\MCCBB_Record\edit_mwo.php on line 40
Date :
2012-03-26 11:13:57
By :
piew
ปิด-เปิด tag php ไม่ถูกครับ
Code (PHP)
<?php require_once('Connections/MCCBB_Record.php'); ?>
<?php
session_start();
if(!isset($_SESSION["MM_Username"])){
header("Location: login.php");
}elseif(($MM_UserGroup == "USER")||($MM_UserGroup == "ADMIN")){
include('checkdate.inc');
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;
}
}
?> // ปิดก่อน
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" />
<title>แก้ไข MWO ใหม่</title>
<link href="web_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php // เปิดใหม่
$cust_ID=$_GET["MWO_No "];
$sql="select * from mwo Where MWO_No ='$MWO_No' ";
$result=mysql_query($sql);
$num_rows = mysql_num_rows($result);
f($num_rows>0){
$rs = mysql_fetch_array($result);
$MWO_No= $rs["MWO_No"];
$Desc_MWO = $rs["Desc_MWO "];
$cust_add= $rs["cust_address"];
$Add_Date = $rs["Add_Date "];
$MM_Username = $rs["MM_Username"];
$Comment_Accept =$rs["Comment_Accept "];
}//end if
?>
<style type="text/css">
<!--
body {
background-color: #F93;
}
-->
</style>
<form method="POST" name="form1" action="<?php echo $editFormAction; ?>">
<h3 align="center" class="head1">แก้ไข MWO ใหม่</h3>
<?php if(!$Result1){?>
<table border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#000000">
<tr>
<td bgcolor="#EEEEEE">
<table align="center" cellspacing="1">
<tr valign="baseline">
<td align="right" valign="middle" nowrap class="style3"><strong class="style3">MWO:</strong></td>
<td><input name="MWO_No" type="text" id="MWO_No" value="<?php echo $_POST['MWO_No'];?>" size="50"></td>
</tr>
<tr valign="baseline">
<td align="right" valign="middle" nowrap="nowrap" class="style1">คำอธิบาย:</td>
<td><input name="Desc_MWO" type="text" id="Desc_MWO" value="<?php echo $_POST['Desc_MWO'];?>" size="50" /></td>
</tr>
<tr valign="baseline">
<td align="right" valign="middle" nowrap class="style1">วันที่เพิ่มงาน:</td>
<td><input name="Add_Date" type="text" id="Add_Date" value="<?php echo $date;?>" size="10" maxlength="10" readonly></td>
</tr>
<tr valign="baseline">
<td align="right" valign="middle" nowrap class="style3"><strong>ผู้บันทึก:</strong></td>
<td><input name="Owner_MWO" type="text" id="Owner_MWO" value="<?php echo $_SESSION["MM_Username"];?>" size="10" readonly></td>
</tr>
<tr valign="baseline">
<td align="right" valign="middle" nowrap class="style1">หมายเหตุ:</td>
<td><label>
<textarea name="Comment" cols="50" rows="5" id="Comment"></textarea>
</label></td>
</tr>
<tr valign="baseline">
<td colspan="2" align="right" nowrap><div align="center">
<input type="submit" value="บันทึก">
<input type="reset" name="Reset" value="Reset">
</div></td>
</tr>
</table>
</td></tr></table>
<input type="hidden" name="MM_insert" value="form1">
<?php }else{ include ('show_new_mwo.php');} //if(!$Result1){?>
</form>
<?
}else{
?>
<div align="center"><span class="style3">คุณไม่มีสิทธิ์ในการใช้หน้านี้</span></div>
<? }?>
</body>
</html>
Date :
2012-03-26 11:20:21
By :
randOmizE
คุณ random ขอบคุณสำหรับคำตอบนะค่ะ
หนูลองแก้ไข มันขึ้น Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at D:\UBNWEB\MCCBB_Record\edit_mwo.php:2) in D:\UBNWEB\MCCBB_Record\edit_mwo.php on line 3
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:\UBNWEB\MCCBB_Record\edit_mwo.php:2) in D:\UBNWEB\MCCBB_Record\edit_mwo.php on line 3
Warning: Cannot modify header information - headers already sent by (output started at D:\UBNWEB\MCCBB_Record\edit_mwo.php:2) in D:\UBNWEB\MCCBB_Record\edit_mwo.php on line 5
ตรงนี้หนูจะแก้ไขยังไงค่ะ
Date :
2012-03-26 11:32:23
By :
piew
แก้ไขได้แล้วค่ะ ขอบคุณพี่ๆที่ช่วยตอบข้อสงสัยน่ะค่ะ ^^
Date :
2012-03-26 11:51:31
By :
piew
แก้แบบนี้
Code (PHP)
<?php
session_start(); // session_start() ต้องอยู่บนสุด ห้ามเคาะ
require_once('Connections/MCCBB_Record.php');
if(!isset($_SESSION["MM_Username"])){
header("Location: login.php");
}elseif(($MM_UserGroup == "USER")||($MM_UserGroup == "ADMIN")){
include('checkdate.inc');
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;
}
}
?> // ปิดก่อน
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" />
<title>แก้ไข MWO ใหม่</title>
<link href="web_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php // เปิดใหม่
$cust_ID=$_GET["MWO_No "];
$sql="select * from mwo Where MWO_No ='$MWO_No' ";
$result=mysql_query($sql);
$num_rows = mysql_num_rows($result);
f($num_rows>0){
$rs = mysql_fetch_array($result);
$MWO_No= $rs["MWO_No"];
$Desc_MWO = $rs["Desc_MWO "];
$cust_add= $rs["cust_address"];
$Add_Date = $rs["Add_Date "];
$MM_Username = $rs["MM_Username"];
$Comment_Accept =$rs["Comment_Accept "];
}//end if
?>
<style type="text/css">
<!--
body {
background-color: #F93;
}
-->
</style>
<form method="POST" name="form1" action="<?php echo $editFormAction; ?>">
<h3 align="center" class="head1">แก้ไข MWO ใหม่</h3>
<?php if(!$Result1){?>
<table border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#000000">
<tr>
<td bgcolor="#EEEEEE">
<table align="center" cellspacing="1">
<tr valign="baseline">
<td align="right" valign="middle" nowrap class="style3"><strong class="style3">MWO:</strong></td>
<td><input name="MWO_No" type="text" id="MWO_No" value="<?php echo $_POST['MWO_No'];?>" size="50"></td>
</tr>
<tr valign="baseline">
<td align="right" valign="middle" nowrap="nowrap" class="style1">คำอธิบาย:</td>
<td><input name="Desc_MWO" type="text" id="Desc_MWO" value="<?php echo $_POST['Desc_MWO'];?>" size="50" /></td>
</tr>
<tr valign="baseline">
<td align="right" valign="middle" nowrap class="style1">วันที่เพิ่มงาน:</td>
<td><input name="Add_Date" type="text" id="Add_Date" value="<?php echo $date;?>" size="10" maxlength="10" readonly></td>
</tr>
<tr valign="baseline">
<td align="right" valign="middle" nowrap class="style3"><strong>ผู้บันทึก:</strong></td>
<td><input name="Owner_MWO" type="text" id="Owner_MWO" value="<?php echo $_SESSION["MM_Username"];?>" size="10" readonly></td>
</tr>
<tr valign="baseline">
<td align="right" valign="middle" nowrap class="style1">หมายเหตุ:</td>
<td><label>
<textarea name="Comment" cols="50" rows="5" id="Comment"></textarea>
</label></td>
</tr>
<tr valign="baseline">
<td colspan="2" align="right" nowrap><div align="center">
<input type="submit" value="บันทึก">
<input type="reset" name="Reset" value="Reset">
</div></td>
</tr>
</table>
</td></tr></table>
<input type="hidden" name="MM_insert" value="form1">
<?php }else{ include ('show_new_mwo.php');} //if(!$Result1){?>
</form>
<?
}else{
?>
<div align="center"><span class="style3">คุณไม่มีสิทธิ์ในการใช้หน้านี้</span></div>
<? }?>
</body>
</html>
Date :
2012-03-26 11:57:42
By :
randOmizE
Load balance : Server 01