ช่วยด้วยครับ Parse error: syntax error, unexpected '"', expecting T_STRING or T_VARIABLE or T_NUM_ST
ช่วยด้วยครับ
Parse error: syntax error, unexpected '"', expecting T_STRING or T_VARIABLE or T_NUM_STRING in /var/www/p.php on line 44
----------------------------------------------------------------------------------------------------------------------------------------
<html>
<head>
<title></title>
</head>
<body>
<?
$objConnect = mysql_connect("localhost","root","999999") or die ("Error Connect to Database");
$objDB = mysql_select_db("online");
//*** Add Condition ***//
if($_POST["hdnCmd"] == "Add")
{
$strSQL = "INSERT INTO form ";
//$strSQL .="(CustomerID,Name,Email,CountryCode,Budget,Used) ";
//$strSQL .="VALUES ";
//$strSQL .="('".$_POST["txtAddCustomerID"]."','".$_POST["txtAddName"]."','".$_POST["txtAddEmail"]."' ";
//$strSQL .=",'".$_POST["txtAddCountryCode"]."','".$_POST["txtAddBudget"]."','".$_POST["txtAddUsed"]."') ";
//$objQuery = mysql_query($strSQL);
$strSQL .="('".$_POST["txtAddid"]."','".$_POST["txtAddname"]."','".$_POST["txtAddgroup"]."','".$_POST["txtAdddate"]."','".$_POST["txtAdddate2"]."','".$_POST["txtAdddate3"]."','".$_POST["txtAddtime"]."','".$_POST["txtAddtime2"]."','".$_POST["txtAdddetails"]."','".$_POST["txtAddstatus"]."') ";
//$strSQL .=",'".$_POST["txtAdddate"]."','".$_POST["txtAdddate2"]."','".$_POST["txtAdddate3"]."' ";
//$strSQL .=",'".$_POST["txtAddtime"]."','".$_POST["txtAddtime2"]."','".$_POST["txtAdddetails"]."','".$_POST["txtAddstatus"]."') ";
$objQuery = mysql_query($strSQL);
if(!$objQuery)
{
echo "Error Save [".mysql_error()."]";
}
//header("location:$_SERVER[PHP_SELF]");
//exit();
}
//*** Update Condition ***//
if($_POST["hdnCmd"] == "Update")
{
//$strSQL = "UPDATE customer SET ";
//$strSQL .="CustomerID = '".$_POST["txtEditCustomerID"]."' ";
//$strSQL .=",Name = '".$_POST["txtEditName"]."' ";
//$strSQL .=",Email = '".$_POST["txtEditEmail"]."' ";
//$strSQL .=",CountryCode = '".$_POST["txtEditCountryCode"]."' ";
//$strSQL .=",Budget = '".$_POST["txtEditBudget"]."' ";
//$strSQL .=",Used = '".$_POST["txtEditUsed"]."' ";
//$strSQL .="WHERE CustomerID = '".$_POST["hdnEditCustomerID"]."' ";
//$objQuery = mysql_query($strSQL);
// $strSQL = "UPDATE form SET";
$strSQL = "UPDATE form SET status='$_POST["txtEditstatus"].' WHERE id = '$_POST["hdnCmd"].' ";
// $strSQL .="id = '".$_POST["txtEditid"]."' ";
// $strSQL .=",name = '".$_POST["txtEditname"]."' ";
// $strSQL .=",group = '".$_POST["txtEditgroup"]."' ";
// $strSQL .=",date = '".$_POST["txtEditdate"]."' ";
// $strSQL .=",date2 = '".$_POST["txtEditdate2"]."' ";
// $strSQL .=",date3 = '".$_POST["txtEditdate3"]."' ";
//$strSQL .=",time = '".$_POST["txtEdittime"]."' ";
//$strSQL .=",time2 = '".$_POST["txtEdittime2"]."' ";
// $strSQL .=",details = '".$_POST["txtEditdetails"]."' ";
//$strSQL .=",status = '".$_POST["txtEditstatus"]."' ";
// $strSQL .="WHERE id = '".$_POST["hdnEditid"]."' ";
$objQuery = mysql_query($strSQL);
if(!$objQuery)
{
echo "Error Update [".mysql_error()."]";
}
//header("location:$_SERVER[PHP_SELF]");
//exit();
}
//*** Delete Condition ***//
if($_GET["Action"] == "Del")
{
$strSQL = "DELETE FROM form ";
$strSQL .="WHERE id = '".$_GET["CusID"]."' ";
$objQuery = mysql_query($strSQL);
if(!$objQuery)
{
echo "Error Delete [".mysql_error()."]";
}
//header("location:$_SERVER[PHP_SELF]");
//exit();
}
$strSQL = "SELECT * FROM form";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
<form name="frmMain" method="post" action="<?=$_SERVER["PHP_SELF"];?>">
<input type="hidden" name="hdnCmd" value="">
<table width="1207" border="1">
<tr>
<th width="47"> <div align="center">ID </div></th>
<th width="123"> <div align="center">Name </div></th>
<th width="90"> <div align="center">Group</div></th>
<th width="263"> <div align="center">Date</div></th>
<th width="156"> <div align="center">Time</div></th>
<th width="241"><div align="center">Details</div></th>
<th width="135"> <div align="center">Status</div></th>
<th width="42"> <div align="center">Edit </div></th>
<th width="52"> <div align="center">Delete </div></th>
</tr>
<?
while($objResult = mysql_fetch_array($objQuery))
{
?>
<?
if($objResult["id"] == $_GET["CusID"] and $_GET["Action"] == "Edit")
{
?>
<tr>
<td>
<div align="center">
<?=$objResult["id"];?>
<input name="hdnEditid" type="hidden" id="hdnEditid" value="<?=$objResult["id"];?>" size="5">
</div></td>
<td><div align="center">
<?=$objResult["name"];?>
</div></td>
<td><div align="center">
<?=$objResult["group"];?>
</div></td>
<td><div align="center"><strong>
<?=$objResult["date"];?>
:
<?=$objResult["date2"];?>
:
<?=$objResult["date3"];?>
</strong></div></td>
<td align="right"><div align="center">
<?=$objResult["time"];?>
:
<?=$objResult["time2"];?>
</div></td>
<td align="right"><div align="center">
<?=$objResult["details"];?>
</div></td>
<td align="right"><div align="center">
<input name="txtEditstatus " type="text" id="txtEditstatus " value="<?=$objResult["status"];?>" size="15">
</div></td>
<td colspan="2" align="right">
<div align="center">
<input name="btnAdd" type="button" id="btnUpdate" value="Update" OnClick="frmMain.hdnCmd.value='Update';frmMain.submit();">
<input name="btnAdd" type="button" id="btnCancel" value="Cancel" OnClick="window.location='<?=$_SERVER["PHP_SELF"];?>';">
</div></td>
</tr>
<?
}
else
{
?>
<tr>
<td>
<div align="center">
<?=$objResult["id"];?>
</div></td>
<td>
<div align="center">
<?=$objResult["name"];?>
</div></td>
<td>
<div align="center">
<?=$objResult["group"];?>
</div></td>
<td><div align="center"><strong>
<?=$objResult["date"];?>
:
<?=$objResult["date2"];?>
:
<?=$objResult["date3"];?>
</strong></div></td>
<td align="right">
<div align="center">
<?=$objResult["time"];?>
:
<?=$objResult["time2"];?>
</div></td>
<td align="right">
<div align="center">
<?=$objResult["details"];?>
</div></td>
<td align="right">
<div align="center">
<?=$objResult["status"];?>
</div></td>
<td align="center"><div align="center"><a href="<?=$_SERVER["PHP_SELF"];?>?Action=Edit&CusID=<?=$objResult["id"];?>">Edit</a></div></td>
<td align="center"><div align="center"><a href="JavaScript:if(confirm('Confirm Delete?')==true){window.location='<?=$_SERVER["PHP_SELF"];?>?Action=Del&CusID=<?=$objResult["id"];?>';}">Delete</a></div></td>
</tr>
<?
}
?>
<?
}
?>
<tr>
<td>
<div align="center">
<input type="text" name="txtAddid" size="5" id="txtAddid">
</div></td>
<td>
<div align="center">
<input type="text" name="txtAddname" size="20" id="txtAddname">
</div></td>
<td>
<div align="center">
<input type="text" name="txtAddgroup" size="15" id="txtAddgroup">
</div></td>
<td>
<div align="center">
<input type="text" name="txtAdddate" size="2" id="txtAdddate">
:
<input type="text" name="txtAdddate2" size="2" id="txtAdddate2">
:
<input type="text" name="txtAdddate3" size="5" id="txtAdddate3">
</div></td>
<td align="right">
<div align="center">
<input type="text" name="txtAddtime" size="5" id="txtAddtime">
:
<input type="text" name="txtAddtime2" size="5" id="txtAddtime2">
</div></td>
<td align="right">
<div align="center">
<input type="text" name="txtAdddetails" size="40" id="txtAdddetails">
</div></td>
<td align="right">
<div align="center">
<input type="text" name="txtAddstatus " size="15" id="txtAddstatus ">
</div></td>
<td colspan="2" align="right">
<div align="center">
<input name="btnAdd" type="button" id="btnAdd" value="Add" OnClick="frmMain.hdnCmd.value='Add';frmMain.submit();">
</div></td>
</tr>
</table>
</form>
<?
mysql_close($objConnect);
?>
</body>
</html>Tag : - - - -
Date :
2010-01-21 16:13:14
By :
care123
View :
4020
Reply :
2
ดูยากมาก มันฟ้องว่าผิดที่บรรทัด 44
ตรงนี้มั้ง
$strSQL = "UPDATE form SET status='$_POST["txtEditstatus"].' WHERE id = '$_POST["hdnCmd"].' ";
เปลี่ยนเป้น
$strSQL = "UPDATE form SET status='".$_POST["txtEditstatus"]."' WHERE id = '".$_POST["hdnCmd"]."' ";
Date :
2010-01-21 16:23:59
By :
ไวยวิทย์
ได้แล้วครับ แต่ data มันไม่เข้าเลย มันไม่แก้ไขให้เลยครับ งง ครับ
Code
<html>
<head>
<title></title>
</head>
<body>
<?
$objConnect = mysql_connect("localhost","root","999999") or die ("Error Connect to Database");
$objDB = mysql_select_db("online");
//*** Add Condition ***//
if($_POST["hdnCmd"] == "Add")
{
$strSQL = "INSERT INTO form ";
//$strSQL .="(CustomerID,Name,Email,CountryCode,Budget,Used) ";
//$strSQL .="VALUES ";
//$strSQL .="('".$_POST["txtAddCustomerID"]."','".$_POST["txtAddName"]."','".$_POST["txtAddEmail"]."' ";
//$strSQL .=",'".$_POST["txtAddCountryCode"]."','".$_POST["txtAddBudget"]."','".$_POST["txtAddUsed"]."') ";
//$objQuery = mysql_query($strSQL);
$strSQL .="('".$_POST["txtAddid"]."','".$_POST["txtAddname"]."','".$_POST["txtAddgroup"]."','".$_POST["txtAdddate"]."','".$_POST["txtAdddate2"]."','".$_POST["txtAdddate3"]."','".$_POST["txtAddtime"]."','".$_POST["txtAddtime2"]."','".$_POST["txtAdddetails"]."','".$_POST["txtAddstatus"]."') ";
//$strSQL .=",'".$_POST["txtAdddate"]."','".$_POST["txtAdddate2"]."','".$_POST["txtAdddate3"]."' ";
//$strSQL .=",'".$_POST["txtAddtime"]."','".$_POST["txtAddtime2"]."','".$_POST["txtAdddetails"]."','".$_POST["txtAddstatus"]."') ";
$objQuery = mysql_query($strSQL);
if(!$objQuery)
{
echo "Error Save [".mysql_error()."]";
}
//header("location:$_SERVER[PHP_SELF]");
//exit();
}
//*** Update Condition ***//
if($_POST["hdnCmd"] == "Update")
{
//$strSQL = "UPDATE customer SET ";
//$strSQL .="CustomerID = '".$_POST["txtEditCustomerID"]."' ";
//$strSQL .=",Name = '".$_POST["txtEditName"]."' ";
//$strSQL .=",Email = '".$_POST["txtEditEmail"]."' ";
//$strSQL .=",CountryCode = '".$_POST["txtEditCountryCode"]."' ";
//$strSQL .=",Budget = '".$_POST["txtEditBudget"]."' ";
//$strSQL .=",Used = '".$_POST["txtEditUsed"]."' ";
//$strSQL .="WHERE CustomerID = '".$_POST["hdnEditCustomerID"]."' ";
//$objQuery = mysql_query($strSQL);
// $strSQL = "UPDATE form SET";
// $strSQL = "UPDATE form SET status='$_POST["txtEditstatus"].' WHERE id = '$_POST["hdnCmd"].' ";
$strSQL = "UPDATE form SET status='".$_POST["txtEditstatus"]."' WHERE id = '".$_POST["hdnCmd"]."' ";
/// $strSQL .="id = '".$_POST["txtEditid"]."' ";
// $strSQL .=",name = '".$_POST["txtEditname"]."' ";
// $strSQL .=",group = '".$_POST["txtEditgroup"]."' ";
// $strSQL .=",date = '".$_POST["txtEditdate"]."' ";
// $strSQL .=",date2 = '".$_POST["txtEditdate2"]."' ";
// $strSQL .=",date3 = '".$_POST["txtEditdate3"]."' ";
//$strSQL .=",time = '".$_POST["txtEdittime"]."' ";
//$strSQL .=",time2 = '".$_POST["txtEdittime2"]."' ";
// $strSQL .=",details = '".$_POST["txtEditdetails"]."' ";
//$strSQL .=",status = '".$_POST["txtEditstatus"]."' ";
// $strSQL .="WHERE id = '".$_POST["hdnEditid"]."' ";
$objQuery = mysql_query($strSQL);
if(!$objQuery)
{
echo "Error Update [".mysql_error()."]";
}
//header("location:$_SERVER[PHP_SELF]");
//exit();
}
//*** Delete Condition ***//
if($_GET["Action"] == "Del")
{
$strSQL = "DELETE FROM form ";
$strSQL .="WHERE id = '".$_GET["CusID"]."' ";
$objQuery = mysql_query($strSQL);
if(!$objQuery)
{
echo "Error Delete [".mysql_error()."]";
}
//header("location:$_SERVER[PHP_SELF]");
//exit();
}
$strSQL = "SELECT * FROM form";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
<form name="frmMain" method="post" action="<?=$_SERVER["PHP_SELF"];?>">
<input type="hidden" name="hdnCmd" value="">
<table width="1207" border="1">
<tr>
<th width="47"> <div align="center">ID </div></th>
<th width="123"> <div align="center">Name </div></th>
<th width="90"> <div align="center">Group</div></th>
<th width="263"> <div align="center">Date</div></th>
<th width="156"> <div align="center">Time</div></th>
<th width="241"><div align="center">Details</div></th>
<th width="135"> <div align="center">Status</div></th>
<th width="42"> <div align="center">Edit </div></th>
<th width="52"> <div align="center">Delete </div></th>
</tr>
<?
while($objResult = mysql_fetch_array($objQuery))
{
?>
<?
if($objResult["id"] == $_GET["CusID"] and $_GET["Action"] == "Edit")
{
?>
<tr>
<td>
<div align="center">
<?=$objResult["id"];?>
<input name="hdnEditid" type="hidden" id="hdnEditid" value="<?=$objResult["id"];?>" size="5">
</div></td>
<td><div align="center">
<?=$objResult["name"];?>
</div></td>
<td><div align="center">
<?=$objResult["group"];?>
</div></td>
<td><div align="center"><strong>
<?=$objResult["date"];?>
:
<?=$objResult["date2"];?>
:
<?=$objResult["date3"];?>
</strong></div></td>
<td align="right"><div align="center">
<?=$objResult["time"];?>
:
<?=$objResult["time2"];?>
</div></td>
<td align="right"><div align="center">
<?=$objResult["details"];?>
</div></td>
<td align="right"><div align="center">
<input name="txtEditstatus " type="text" id="txtEditstatus " value="<?=$objResult["status"];?>" size="15">
</div></td>
<td colspan="2" align="right">
<div align="center">
<input name="btnAdd" type="button" id="btnUpdate" value="Update" OnClick="frmMain.hdnCmd.value='Update';frmMain.submit();">
<input name="btnAdd" type="button" id="btnCancel" value="Cancel" OnClick="window.location='<?=$_SERVER["PHP_SELF"];?>';">
</div></td>
</tr>
<?
}
else
{
?>
<tr>
<td>
<div align="center">
<?=$objResult["id"];?>
</div></td>
<td>
<div align="center">
<?=$objResult["name"];?>
</div></td>
<td>
<div align="center">
<?=$objResult["group"];?>
</div></td>
<td><div align="center"><strong>
<?=$objResult["date"];?>
:
<?=$objResult["date2"];?>
:
<?=$objResult["date3"];?>
</strong></div></td>
<td align="right">
<div align="center">
<?=$objResult["time"];?>
:
<?=$objResult["time2"];?>
</div></td>
<td align="right">
<div align="center">
<?=$objResult["details"];?>
</div></td>
<td align="right">
<div align="center">
<?=$objResult["status"];?>
</div></td>
<td align="center"><div align="center"><a href="<?=$_SERVER["PHP_SELF"];?>?Action=Edit&CusID=<?=$objResult["id"];?>">Edit</a></div></td>
<td align="center"><div align="center"><a href="JavaScript:if(confirm('Confirm Delete?')==true){window.location='<?=$_SERVER["PHP_SELF"];?>?Action=Del&CusID=<?=$objResult["id"];?>';}">Delete</a></div></td>
</tr>
<?
}
?>
<?
}
?>
<tr>
<td>
<div align="center">
<input type="text" name="txtAddid" size="5" id="txtAddid">
</div></td>
<td>
<div align="center">
<input type="text" name="txtAddname" size="20" id="txtAddname">
</div></td>
<td>
<div align="center">
<input type="text" name="txtAddgroup" size="15" id="txtAddgroup">
</div></td>
<td>
<div align="center">
<input type="text" name="txtAdddate" size="2" id="txtAdddate">
:
<input type="text" name="txtAdddate2" size="2" id="txtAdddate2">
:
<input type="text" name="txtAdddate3" size="5" id="txtAdddate3">
</div></td>
<td align="right">
<div align="center">
<input type="text" name="txtAddtime" size="5" id="txtAddtime">
:
<input type="text" name="txtAddtime2" size="5" id="txtAddtime2">
</div></td>
<td align="right">
<div align="center">
<input type="text" name="txtAdddetails" size="40" id="txtAdddetails">
</div></td>
<td align="right">
<div align="center">
<input type="text" name="txtAddstatus " size="15" id="txtAddstatus ">
</div></td>
<td colspan="2" align="right">
<div align="center">
<input name="btnAdd" type="button" id="btnAdd" value="Add" OnClick="frmMain.hdnCmd.value='Add';frmMain.submit();">
</div></td>
</tr>
</table>
</form>
<?
mysql_close($objConnect);
?>
</body>
</html>
Date :
2010-01-21 16:38:38
By :
care123
Load balance : Server 00