|
|
|
ผิดตรงไหนครับ ผมหาไม่เจอ syntax error, unexpected T_ELSEIF |
|
|
|
|
|
|
|
syntax error, unexpected T_ELSEIF in C:\AppServ\www\work_new\Contract_Equip.php on line 212
Code (PHP)
<?php
ob_start();
?>
<!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=utf-8" />
<title>รายละเอียดอุปกรณ์ในสัญญา</title>
<script type="text/javascript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>
<body>
<?php
include "connect.php";
$conn->open($sql);
$rs = $conn->execute("SELECT Table_Contract_Info.*,Table_Vender.* FROM Table_Contract_Info,Table_Vender WHERE (Table_Vender.ID_Vender=Table_Contract_Info.ID_Vender) AND ID_Contract_Info like '".$_GET['ID_Contract_Info']."'");
?>
<table width="1024" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="135" align="center">หมายเลขสัญญา</td>
<td width="131" align="center">เลขที่ใบสั่งซื้อ</td>
<td width="151" align="center">ชื่อบริษัทเครื่องเช่า</td>
<td width="129" align="center">วันเริ่มสัญญา</td>
<td width="144" align="center">วันสิ้นสุดสัญญา</td>
<td width="116" align="center">หมายเหตุ</td>
</tr>
<tr>
<td align="center"><?=$rs->Fields['Contract_No']->Value?></td>
<td align="center"><?=$rs->Fields['PurchaseOrder_No']->Value?></td>
<td align="center"><?=$rs->Fields['Company_Name']->Value?></td>
<td align="center"><?=$rs->Fields['Start_Date']->Value?></td>
<td align="center"><?=$rs->Fields['End_Date']->Value?></td>
<td align="center"><?=$rs->Fields['Description_Contract']->Value?></td>
</tr>
</table>
<?php
$rs->Close();
$conn->Close();
?>
<br />
<p>
<form name="form1" id="form1">
Center No.
<select name="Center_Sel" id="Center_Sel" onchange="MM_jumpMenu('parent',this,0)">
<?php
$conn->open($sql);
$rs = $conn->execute("SELECT DISTINCT Table_Budget.ID_Contract_Info, Table_Function.ID_Center_Owner, Table_Center_Owner.ID_Center_Info, Table_Center_Info.CenterNo
FROM ((Table_Center_Info INNER JOIN Table_Center_Owner ON Table_Center_Info.ID_Center_Info = Table_Center_Owner.ID_Center_Info) INNER JOIN Table_Function ON Table_Center_Owner.ID_Center_Owner = Table_Function.ID_Center_Owner) INNER JOIN Table_Budget ON Table_Function.ID_Function = Table_Budget.ID_Function WHERE (Table_Budget.[ID_Contract_Info]) Like '".$_GET['ID_Contract_Info']."'");
//$ID_Center_Owner = $rs->Fields['ID_Center_Owner']->Value;
//$rs->Close();
//$rs1 = $conn->execute("Select * From Table_Center_Owner,Table_Center_Info Where Table_Center_Owner.ID_Center_Info=Table_Center_Info.ID_Center_Info AND ID_Center_Owner LIKE '%".$ID_Center_Owner."%'");
?>
<option selected="selected" disabled="disabled">เลือก Center</option>
<?php
while (!$rs->EOF)
{
?>
<option value="Contract_Equip.php?ID_Contract_Info=<?=$_GET['ID_Contract_Info']?>&ID_Center_Owner=<?=$rs->Fields['ID_Center_Owner']->Value ?>" <? if($_GET[ID_Center_Owner]==($rs->Fields['ID_Center_Owner']->Value) ){echo "selected=\"selected\"";}?>><?=$rs->Fields['CenterNo']->Value ?></option>
<?php
$rs->MoveNext();
}
$rs->Close();
$conn->Close();
?>
</select>
Function
<select name="Center_Sel" id="Center_Sel" onchange="MM_jumpMenu('parent',this,0)">
<?php
$conn->open($sql);
$rs = $conn->execute("Select Table_Center_Owner.*,Table_Function.* From Table_Center_Owner,Table_Function Where Table_Center_Owner.ID_Center_Owner=Table_Function.ID_Center_Owner AND Table_Function.ID_Center_Owner Like '".$_GET['ID_Center_Owner']."'");
//$ID_Center_Owner = $rs->Fields['ID_Center_Owner']->Value;
//$rs->Close();
//$rs1 = $conn->execute("Select Table_Center_Owner.*,Table_Center_Info.*,Table_User_Info.* From Table_Center_Owner,Table_Center_Info,Table_User_Info Where Table_Center_Owner.ID_Center_Info=Table_Center_Info.ID_Center_Info AND Table_Center_Owner.ID_PersonalNo=Table_User_Info.ID_PersonalNo LIKE '%".$ID_Center_Owner."%'");
?>
<option selected="selected" disabled="disabled">เลือก Function</option>
<?php
while (!$rs->EOF)
{
?>
<option value="Contract_Equip.php?list=list_eq&ID_Contract_Info=<?=$_GET['ID_Contract_Info']?>&ID_Center_Owner=<?=$rs->Fields['ID_Center_Owner']->Value?>&ID_Function=<? if ($_GET[ID_Center_Owner]!="") {echo $rs->Fields['ID_Function']->Value;} ?>" <? if($_GET[ID_Function]==$rs->Fields['ID_Function']->Value){echo "selected=\"selected\"";}?>><?=$rs->Fields['Function_Name']->Value ?></option>
<?php
$rs->MoveNext();
}
$rs->Close();
$conn->Close();
?>
</select>
</form>
</p>
<p>
<?php
if($_GET['list'] == "list_eq")
{
$conn->open($sql);
$rs1 = $conn->execute("SELECT Table_Budget.ID_Budget, Table_Budget.ID_Equipment, Table_Budget.Budget_Price, Table_Budget.Budget_Amount, Table_Budget.Acc_Price, Table_Budget.Acc_Amount, Table_Budget.Remark, Table_Equipment_Type.Equipment_Type, Table_Equipment_Type.Brand, Table_Equipment_Type.Model, Table_Equipment_Type.Processor_Speed, Table_Equipment_Type.Memory, Table_Equipment_Type.Capacity
FROM Table_Equipment_Type INNER JOIN Table_Budget ON Table_Equipment_Type.ID_Equipment = Table_Budget.ID_Equipment Where ID_Contract_Info Like '".$_GET[ID_Contract_Info]."' AND ID_Function Like '".$_GET[ID_Function]."'");
?>
<table width="1024" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="88" rowspan="2" align="center">ชนิดอุปกรณ์</td>
<td width="40" rowspan="2" align="center">ยี่ห้อ</td>
<td width="25" rowspan="2" align="center">รุ่น</td>
<td width="56" rowspan="2" align="center">ความเร็ว</td>
<td width="70" rowspan="2" align="center">Memory</td>
<td width="70" rowspan="2" align="center">ความจุ</td>
<td colspan="2" align="center">Budget</td>
<td colspan="2" align="center">Accual</td>
<td width="75" rowspan="2" align="center">จัดการ</td>
</tr>
<tr>
<td width="144" align="center">ราคา</td>
<td width="144" align="center">จำนวน</td>
<td width="144" align="center">ราคา</td>
<td width="144" align="center">จำนวน</td>
</tr>
<?php
while (!$rs1->EOF)
{
?>
<tr>
<td align="center"><?=$rs1->Fields['Equipment_Type']->Value?></td>
<td align="center"><?=$rs1->Fields['Brand']->Value?></td>
<td align="center"><?=$rs1->Fields['Model']->Value?></td>
<td align="center"><?=$rs1->Fields['Processor_Speed']->Value?></td>
<td align="center"><?=$rs1->Fields['Memory']->Value?></td>
<td align="center"><?=$rs1->Fields['Capacity']->Value?></td>
<td align="center"><?=$rs1->Fields['Budget_Price']->Value?></td>
<td align="center"><?=$rs1->Fields['Budget_Amount']->Value?></td>
<td align="center"><?=$rs1->Fields['Acc_Price']->Value?></td>
<td align="center"><?=$rs1->Fields['Acc_Amount']->Value?></td>
<td align="center"><a href="Contract_Equip.php?Mod=edit&ID_Contract_Info=<?=$_GET['ID_Contract_Info']?>&ID_Center_Owner=<?=$_GET['ID_Center_Owner']?>&ID_Function=<?=$_GET['ID_Function']?>&ID_Budget=<?=$rs1->Fields['ID_Budget']->Value?>">Edit</a> <a href="JavaScript:if(confirm('Confirm Delete?')==true){window.location='Contract_Equip.php?Mod=del&ID_Contract_Info=<?=$_GET['ID_Contract_Info']?>&ID_Center_Owner=<?=$_GET['ID_Center_Owner']?>&ID_Function=<?=$_GET['ID_Function']?>&ID_Budget=<?=$rs1->Fields['ID_Budget']->Value?>';}">Delete</a></td>
</tr>
<?php
$rs1->MoveNext();
}
$rs1->Close();
$conn->Close();
if($_GET['Mod'] == "new")
{
if($_POST['submit_save'] != "")
{
$conn->open($sql);
$str = "insert into Table_Budget (`ID_Equipment`,`ID_Contract_Info`,`ID_Function`,`Budget_Price`,`Budget_Amount`,`Acc_Price`,`Acc_Amount`) values(".$_POST['ID_Equipment'].",".$_GET['ID_Contract_Info'].",".$_GET['ID_Function'].",'".$_POST['Budget_Price']."',".$_POST['Budget_Amount'].",'".$_POST['Acc_Price']."',".$_POST['Acc_Amount'].");";
$rs = $conn->execute($str);
//$rs->Close();
//$conn->Close();
header("Location: Contract_Equip.php?list=list_eq&ID_Contract_Info=".$_GET['ID_Contract_Info']."&ID_Center_Owner=".$_GET['ID_Center_Owner']."&ID_Function=".$_GET['ID_Function']."");
}//ปิด Submit_save
?>
<form action="Contract_Equip.php?list=list_eq&Mod=new&ID_Contract_Info=<?=$_GET['ID_Contract_Info']?>&ID_Center_Owner=<?=$_GET['ID_Center_Owner']?>&ID_Function=<?=$_GET['ID_Function']?>" method="POST" name="form2" id="form2">
<tr>
<td align="center">
<label>
<select name="ID_Equipment" id="ID_Equipment">
<?php
$conn->open($sql);
$str = "select * from Table_Equipment_Type";
$rs = $conn->execute($str);
while (!$rs->EOF)
{
?>
<option value="<?=$rs->Fields['ID_Equipment']->Value?>"><?=$rs->Fields['Equipment_Type']->Value?></option>
<?php
$rs->MoveNext();
} //ปิด while
$rs->Close();
$conn->Close();
?>
</select>
</label>
</td>
<td align="center">1</td>
<td align="center">1</td>
<td align="center">1</td>
<td align="center">1</td>
<td align="center">1</td>
<td align="center"><input name="Budget_Price" type="text" value=""></td>
<td align="center"><input name="Budget_Amount" type="text" value=""></td>
<td align="center"><input name="Acc_Price" type="text" value=""></td>
<td align="center"><input name="Acc_Amount" type="text" value=""></td>
<td align="center"><input name="submit_save" type="submit" value="Save"></td>
</tr>
<?php
}
?>
</form>
<?php
elseif($_GET['Mod'] == "edit")
{
if($_GET['save1'] == "true")
{
$conn->open($sql);
$str = "Update Table_Contract_Info set Contract_No='".$_POST['Contract_No']."',PurchaseOrder_No='".$_POST['PurchaseOrder_No']."',ID_Vender='".$_POST['ID_Vender']."',Start_Date='".$_POST['Start_Date']."',End_Date='".$_POST['End_Date']."',Description_Contract='".$_POST['Description_Contract']."' where ID_Contract_Info Like '".$_GET['ID_Contract_Info']."'";
$rs = $conn->execute($str);
$conn->Close();
header("Location: Contract_Equip.php?list=list_eq&ID_Contract_Info=".$_GET['ID_Contract_Info']."&ID_Center_Owner=".$_GET['ID_Center_Owner']."&ID_Function=".$_GET['ID_Function']."");
}//ปิด if save1
$conn->open($sql);
$rs = $conn->execute("select * from Table_Budget WHERE ID_Budget like '".$_GET['ID_Budget']."'");
$ID_Equipment = $rs->Fields['ID_Equipment']->Value;
$ID_Contract_Info = $rs->Fields['ID_Contract_Info']->Value;
$ID_Function = $rs->Fields['ID_Function']->Value;
$Budget_Price = $rs->Fields['Budget_Price']->Value;
$Budget_Amount = $rs->Fields['Budget_Amount']->Value;
$Acc_Price = $rs->Fields['Acc_Price']->Value;
$Acc_Amount = $rs->Fields['Acc_Amount']->Value;
$rs->Close();
?>
<form action="Contract_Equip.php?Mod=edit&save1=true&Contract_Equip.php?Mod=edit&ID_Contract_Info=<?=$_GET['ID_Contract_Info']?>&ID_Center_Owner=<?=$_GET['ID_Center_Owner']?>&ID_Function=<?=$_GET['ID_Function']?>&ID_Budget=<?=$_GET['ID_Budget']?>" method="POST" name="form3" id="form3">
<tr>
<td align="center">
<select name="ID_Equipment" id="ID_Equipment">
<?php
$rs = $conn->execute("SELECT * FROM Table_Budget Where ID_Budget Like '".$_GET['ID_Budget']."'");
$ID_Equipment = $rs->Fields['ID_Equipment']->Value;
$rs->Close() ;
$rs = $conn->execute("select * from Table_Equipment_Type");
while (!$rs->EOF)
{
?>
<option value="<?=$rs->Fields['ID_Equipment']->Value ?>"<? if($ID_Equipment==$rs->Fields['ID_Equipment']->Value){echo "selected=\"selected\"";}?>><?=$rs->Fields['Equipment_Type']->Value ?></option>
<?
$rs->MoveNext();
} //ปิด while
$rs->Close() ;
?>
</select>
</td>
<td align="center">1</td>
<td align="center">1</td>
<td align="center">1</td>
<td align="center">1</td>
<td align="center">1</td>
<td align="center"><input name="Budget_Price" type="text" value="<?=$Budget_Price?>"></td>
<td align="center"><input name="Budget_Amount" type="text" value="<?=$Budget_Amount?>"></td>
<td align="center"><input name="Acc_Price" type="text" value="<?=$Acc_Price?>"></td>
<td align="center"><input name="Acc_Amount" type="text" value="<?=$Acc_Amount?>"></td>
<td align="center"><input name="Submit" type="submit" value="Save"></td>
</tr>
</form>
<br>
<?php
}//ปิด edit
elseif($_GET['Mod'] == "del")
{
$conn->open($sql);
$rs = $conn->execute("Delete from Table_Budget where ID_Budget = ".$_GET['ID_Budget']."");
$conn->Close();
header("Location: Contract_Equip.php?list=list_eq&ID_Contract_Info=".$_GET['ID_Contract_Info']."&ID_Center_Owner=".$_GET['ID_Center_Owner']."&ID_Function=".$_GET['ID_Function']."");
}//ปิด del
}
?>
</table>
<form action="Contract_Equip.php?list=list_eq&Mod=new&ID_Contract_Info=<?=$_GET['ID_Contract_Info']?>&ID_Center_Owner=<?=$_GET['ID_Center_Owner']?>&ID_Function=<?=$_GET['ID_Function']?>" method="POST" name="form4" id="form4">
<input name="submit_new" type="submit" value="New">
</form>
</p>
<?php
?>
</body>
</html>
ผมลองไล่ปีกกาดูแล้วก็ครบนะครับ มันผิดอะไรอ่าครับ
ปล.ผมมือใหม่นะครับ ขอบคุณมากครับ
Tag : PHP
|
|
|
|
|
|
Date :
2011-02-16 09:06:17 |
By :
PikaboyZ |
View :
865 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
line 212. elseif($_GET['Mod'] == "edit")
คุณต้องเคาะ space เว้นวรรคระหว่าง else if ครับ ขอบคุณครับ
|
|
|
|
|
Date :
2011-02-16 09:19:12 |
By :
chubichane |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|