ช่วยดูโค้ดที่ผมเขียนให้ทีคับเป็นจะดึงข้อมูลจาก access มาโชว์บนเว็บนะคับ พอดีรันแล้วมันerror คับ
Code (PHP)
<?php
include "connect.php";
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>usage_check</title>
<script type="text/javascript">
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
</script>
</head>
<body onLoad="MM_preloadImages('/multifunction/indexC_03.jpg','/multifunction/indexC_04.jpg','/multifunction/indexC_05.jpg','/multifunction/indexC_06.jpg','/multifunction/indexC_07.jpg')">
<table width="960" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="7"><img src="/multifunction/index_01.jpg" width="960" height="244" /></td>
</tr>
<tr>
<td><img src="/multifunction/index_02.jpg" width="176" height="49" /></td>
<td><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image14','','/multifunction/indexC_03.jpg',1)"><img src="/multifunction/index_03.jpg" name="Image14" width="46" height="49" border="0" id="Image14" /></a></td>
<td><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image15','','/multifunction/indexC_04.jpg',1)"><img src="/multifunction/index_04.jpg" name="Image15" width="81" height="49" border="0" id="Image15" /></a></td>
<td><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image16','','/multifunction/indexC_05.jpg',1)"><img src="/multifunction/index_05.jpg" name="Image16" width="96" height="49" border="0" id="Image16" /></a></td>
<td><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image17','','/multifunction/indexC_06.jpg',1)"><img src="/multifunction/index_06.jpg" name="Image17" width="98" height="49" border="0" id="Image17" /></a></td>
<td><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image18','','/multifunction/indexC_07.jpg',1)"><img src="/multifunction/index_07.jpg" name="Image18" width="84" height="49" border="0" id="Image18" /></a></td>
<td><img src="/multifunction/index_08.jpg" width="379" height="49" /></td>
</tr>
<tr>
<td> </td>
<td colspan="2"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="7"> </td>
</tr>
<tr>
<td colspan="7" bgcolor="#FFFFFF"><?php
$conn->open($sql);
$rs = $conn->execute("SELECT DISTINCT a.* FROM TB_ALL_Usage Chage a where (a.Center like '%". str_replace(" ","",$_POST["center_no"]) ."%') order by a.Month ");?>
<table width="894" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<th width="87" scope="col"><img src="Header_Table(900)_01.jpg" width="87" height="72" /></th>
<th colspan="4" scope="col"><img src="Header_Table(900)_02.jpg" width="183" height="72" /></th>
<th colspan="4" scope="col"><img src="Header_Table(900)_03.jpg" width="186" height="72" /></th>
<th width="123" scope="col"><img src="Header_Table(900)_04.jpg" width="123" height="72" /></th>
<th colspan="4" scope="col"><img src="Header_Table(900)_05.jpg" width="190" height="72" /></th>
<th width="111" scope="col"><img src="Header_Table(900)_06.jpg" width="111" height="72" align="left" /></th>
</tr>
<?php while (!$rs->EOF) {
if($rs!=''){
?>
<tr>
<td><?php echo $rs['Date'] ; ?> </td>
<td width="45"><?php echo number_format($rs['CopyBlackSmall'],0,"",","); $total_CopyBlackSmall+=$rs['CopyBlackSmall'];?></td>
<td width="44"><?php echo number_format($rs['CopyBlackLange'],0,"",","); $total_CopyBlackLange+=$rs['CopyBlackLange'];?></td>
<td width="45"><?php echo number_format($rs['CopyColorA3'],0,"",","); $total_CopyColorA3+=$rs['CopyColorA3'];?></td>
<td width="43"><?php echo number_format($rs['CopyColorA4'],0,"",","); $total_CopyColorA4+=$rs['CopyColorA4'];?></td>
<td width="45"><?php echo $rs['PrintBlackSmall'] ; $total_PrintBlackSmall+=$rs['PrintBlackSmall'] ; ?></td>
<td width="44"><?php echo $rs['PrintBlackLange'] ; $total_PrintBlackLange+=$rs['PrintBlackLange'] ; ?></td>
<td width="47"><?php echo $rs['PrintColorA3'] ; ?></td>
<td width="44"><?php echo $rs['PrintColorA4'] ; ?></td>
<td><?php echo $rs['TotalUsageChage'] ; ?></td>
<td width="45"><?php echo $rs['PrintBlackSmall']; ?></td>
<td width="45"><?php echo $rs['PriceBlackLange'] ; ?></td>
<td width="48"><?php echo $rs['PriceColorA3'] ; ?></td>
<td width="46"><?php echo $rs['PriceColorA4'] ; ?></td>
<td><?php echo $rs['TotalPrice'] ; ?></td>
</tr>
<?php }else { ?>
<td colspan="15"> </td>
<?php $rs->Close() ;
$conn->Close() ;
?>
</table>
<p> </p>
<p> </p></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> </td>
<td colspan="2" bgcolor="#FFFFFF"> </td>
<td bgcolor="#FFFFFF"> </td>
<td bgcolor="#FFFFFF"> </td>
<td bgcolor="#FFFFFF"> </td>
<td bgcolor="#FFFFFF"> </td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> </td>
<td colspan="2" bgcolor="#FFFFFF"> </td>
<td bgcolor="#FFFFFF"> </td>
<td bgcolor="#FFFFFF"> </td>
<td bgcolor="#FFFFFF"> </td>
<td bgcolor="#FFFFFF"> </td>
</tr>
<tr>
<td colspan="7" bgcolor="#FFFFFF"><img src="/multifunction/index_24.jpg" width="960" height="39" /></td>
</tr>
</table>
</body>
</html>
_________________________________________________________________________________________________
มันฟ้อง >> Code
Parse error: syntax error, unexpected $end in C:\AppServ\www\multifunction\view_usage_check.php on line 128
Tag : PHP, Ms Access, MySQL, CakePHP, Web (ASP.NET)
Date :
2012-01-20 09:11:42
By :
korawit13
View :
779
Reply :
3
น่าจะลืมปิดปีกกาครับ }
Date :
2012-01-20 10:29:36
By :
webmaster
ผมพยามทวนแล้วนะคับ แต่ยังหาไม่เจอ แต่ยังไงก็ขอบคุณพี่มากนะคับ
Date :
2012-01-20 10:53:47
By :
korawit13
หาเจอละคับ แต่พอรันอีกทีก็มาติดตรงนี้อีกนะคับ ช่วยแก้ทีนะคับ
Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> Microsoft OLE DB Provider for ODBC Drivers<br/><b>Description:</b> [Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause.' in C:\AppServ\www\multifunction\view_usage_check.php:62 Stack trace: #0 C:\AppServ\www\multifunction\view_usage_check.php(62): com->execute('SELECT DISTINCT...') #1 {main} thrown in C:\AppServ\www\multifunction\view_usage_check.php on line 62
Date :
2012-01-20 11:22:15
By :
korawit13
Load balance : Server 03