Parse error: syntax error, unexpected T_LOGICAL_OR in C:\AppServ\www\viewPackage.php on line 24 ผมใส่or die mysql_error()แล้วครับ
Code (PHP)
<?
session_start();
include"checksession.php";
include"ConnectionDb.php";
?><?
$page=$_GET['page'];
if($page==""){
$page=1;
}
$each=10;
$sql_product="SELECT* FROM tbpackren";
$result_product= mysql_query($sql_product);
$totals=mysql_num_rows($result_product);
$totalpages=ceil($totals/$each);
$goto=($page-1)*$each;
$sql_product = "SELECT*FROM tbpackren ORDER BY pkrenid DESC limit $goto,$each";
$result_product = mysql_query($sql_product);
$sql="SELECT MAX (pkrenid) AS pkrenid FROM tbpackren";
$result=mysql_query($sql);or die mysql_error();
$dbarr= mysql_fetch_array($result);
if($num=="0"){
$total="0001";
}else{
$total=$dnarr['pkrenid']+1;
if($total<10){
$total="000".$total;
}elseif ($total<100){
$total="00".$total;
} elseif ($total<1000){
$total="0".$total;
}
}
?>
<table width="700" border="0" align="center" cellpadding="1" cellspacing="1" bordercolordark="#FFFFFF">
<tr>
<td colspan="5" bgcolor="#FFCCCC" align="center"><b>รายการข้อมมูลโปรโมชั่นชุด</b></td>
</tr>
<tr bgcolor="#FFFFCC">
<td width="169" align="center">รหัสโปรโมชั่น</td>
<td width="320" align="center">ชื่อโปโมชั่น</td>
<td width="102" align="center">แก้ไข</td>
<td width="109" align="center">ลบ</td>
</tr>
<?
while ($dbarr_product = mysql_fetch_array($result_product)){
?>
<tr bgcolor="#F4F4F4">
<td align="center"><?=$dbarr_product['pkrenid'];?></td>
<td> <?=$dbarr_product['pkrenname'];?></td>
<td align="center">[<a href="main.php?menu=2&do=edit&id=<?=$dbarr_product['pkrenid'];?>">แก้ไข</a>]</td>
<td align="center">[<a href="main.php?menu=2&do=delete&id=<?=$dbarr_product['pkrenid'];?>">ลบ</a>]</td>
</tr>
<?
}
?>
<tr bgcolor="#F4F4F4">
<td colspan="4" align="rigth">มีทั้งหมด<?=$total;?>รายการ:
<?
if ($totalpages>1){
for ($i=1;$i<$totalpages;$i++){
if($i==$page){
echo"<b>หน้า $page</b>";
}else{
echo"|<a href=\"main.php?manu=2&do=add&page=$i\">$i</a> ";
}
}
}
?>
</td>
</tr>
</table>
<form name="frmpackage" method="post" action="main.php?menu=2&do=add&doing=add" enctype="multipart/form-date">
<table width="300" border="0" align="center" cellpadding="0" cellspacing="0"
bordercolordark="#FFFFFF">
<tr>
<td bgcolor="FFCCCC" align="center" <b>เพิ่มข้อมูล</b></td>
</tr>
<tr>
<td>
<table width="700" border="0" align="center" cellpadding="5" cellspacing="1">
<tr bgcolor="#F4F4F4">
<td width="50%" align="left">รหัสโปรโมชั่น<input maxLength=3 name=pkrenid value="<?=$total;?>" size="8"></td>
<td width="50%" align="left"ประเภทชุด<select name="ref_sectionid">
<option value="0">กรุณาเลือกประเภทชุด</option>
<?
$sql="select*from tbsection";
$result= mysql_query($sql);
while($darr_product= mysql_fetch_array($reult)){
echo"<option value=$dbarr_product[sectionid]>$dbarr_product
[sectionname]</option>";
}
?>
</select>
</td>
</tr>
<tr bgcolor="#F4F4F4">
<td colspan="4" align="left">ชื่อโปรโมชั่น<input maxlength="150" name="pkrenname"size="80"></td>
</tr>
<tr>
<td align="left">ราคา/ชุด <input maxlength="50" name="unitprice" size="8">บาท</td>
<td align="left">ไฟล์รูปภาพ<input type="file" name="photo"><input type ="hidden"name="MEX_FILE_SIZE" value="1000000"></td>
</tr>
<tr bgcolor="#F4F4F4">
<td align="left">รายละเอียดโดยย่อ<br><textarea name="txtdatetail" cols="40" rows="4"></textarea></td>
<td align="left">สิ่งที่นำมาติดต่อ<br><textarea name="remark" cols="40" rows="4"></textarea></td>
</tr>
<tr bgcolor="#F4F4F4">
<td align="left">อัตรานี้รวม<br><textarea name="pkinclude" cols="40" rows="3"></textarea></td>
<td align="left">อัตราไม่นี้รวม<br><textarea name="pknotinclude" cols="40" rows="3"></textarea></td>
</tr>
<tr bgcolor="#F4F4F4">
<td colspan="2" align="left"รายระเอียดต่างๆ<br><textarea name="txtAct" cols="100" rows="30"></textarea>
</tr>
<tr bgcolor="#F4F4F4">
<td colspan="6" align="center">
<input type="submit" name="submin" value="บันทึก">
<input type="reset" name="Reset" value="ล้างข้อมูล">
<input name="cid" type="hidden" value="<?=$total;?>">
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<?
if ($_REQEST['doing']=="ad"){
if(($_REQSET['pkrenid']=="")or ($_REQUEST['pkrenname']=="")or($_REQUEST['ref_sectionid']=="")){
echo"<h1>กรุณากรอกข้อมูลให้ครบ</h1>";
}else{
$pkrenid=$_POST['pkrenid'];
$sectionid=$_POST['ref_sectionid'];
$pkrenname=$_POST['pkrenname'];
$txtdetail=$_POST['txtdetail'];
$pkinclude=$_POST['pkinclude'];
$pknotinclude=$_POST['pknotinclude'];
$remark=$_POST['remark'];
$unitprice=number_format($_POST['unitprice'],2,'.','');
$txtact=$_POST['txtAct'];
$photo=$_FILES['photo']['tmp_name'];
$photo_name-$_FILES['photo']['name'];
$photo_size=$_FILES['photo']['size'];
$photo_type=$_FILES['photo']['type'];
if($photo==""){
$sql_add="INSERT INTO tbpackren (pkrenid,pkrenname,pkdatetail,unitprice,ref_sectionid,pkinclude,pknotinclude,remark,activity,pkpicren)
VALUES ('$pkrenid','$pkrenname','$txtail','$unitprice','$sectionid','$pkinclude','$pknotinclude','$remark',$txtact','');";
if($result_add){
echo"บันทึกข้อมูลเรียบร้อบแล้ว";
echo"<meta http-equiv='refresh' content='1;url=main.php?manu=2&do=add'>";
}else{
echo"<h1>ไม่สามารถบันทึกข้อมูลได้</h1>";
echo"<meat http-equiv='refresh' content='1;url=main.php'>";
}
}else{
$array_last= explode(".",$photo_name);
$c=count($array_last)-1;
$lastname=strtolower($array_last[$c]);
if ($lastname=="gif" or $lastname=="jpg" or lastname=="jpeg"){
$set_photo=explode(".",$photo_name);
$plname="pk_".$pkrenid;
$plname=$set_photo[1];
$photoname=$pnname.".".$plnanme;
copy ($photo,"..images/package/".$photoname);
$sql_add="INSERT INTO tbpackren (pkrenid,pkrenname,pkdetail,unitprice,ref_sectionid,pkinclude,pknotinclude,remark,activity,pkpicren)
VALUE ('$pkrenid','$pkrenname','$txtetail','$unitpice','$sectionid','$pkinclude','$pknotinclude','$remark','$txtact','$photoname');";
$result_add=mysql_query($sql_add);
if($result_add){
echo "บันทึกข้อมูลเรียบร้อยแล้ว";
echo "<meta http-equiv='refresh' content='1;url=main.php?manu=2&do=add'>";
}else{
echo"<h1>ไม่สามารถบันทึกข้อมูลได้</h1>";
echo"<meta http-equiv='refresh' content='1;url=main.php'>";
}
}else{
echo "<h1>ไม่สามารถบันทึกไฟร์รูปภาพได้(ต้องเป็น .jpg ,.gif เท่านั้น) </h1>";
echo "<meta http-equiv='refresh' content-'1;url=main.php'>";
}
unlink ($photo);
}
}
}
?><?
include "CloseDb.php";
?>
Tag : PHP, MySQL
Date :
2012-02-03 11:16:47
By :
hhgolfhh
View :
1247
Reply :
1
ลองเขียนแบบนี้ดูสิจ๊ะ
Code (PHP)
$result = mysql_query($sql) or die(error_msg(mysql_error(),$sql));
// บรรทัดที่ 24 อะ
Date :
2012-02-03 15:37:37
By :
เจ้าปัญหา
Load balance : Server 05