ช่วยแก้ error PHP ที่คับรันแล้วมันฟ้องerror แบบนี้ Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> Microsoft OLE DB Provider for ODBC D
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" alt="home" 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" alt="servioes requesition" 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" alt="e-learning" 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" alt="tpie-tricks" 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"><?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 ");?></td>
</tr>
<tr>
<td colspan="7"><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> </td>
<td colspan="2"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td colspan="2"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="7" bgcolor="#FFFFFF"><img src="/multifunction/index_24.jpg" width="960" height="39" /></td>
</tr>
</table>
</body>
</html>
รันแล้วมันขึ้นแบบนี้อะคับ ท่านผู้รู้ช่วยทีนะคับ
Code
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:59 Stack trace: #0 C:\AppServ\www\multifunction\view_usage_check.php(59): com->execute('SELECT DISTINCT...') #1 {main} thrown in C:\AppServ\www\multifunction\view_usage_check.php on line 59
Date :
2012-01-23 10:51:33
By :
korawit13
SQL Error :
SELECT DISTINCT a.* FROM TB_ALL_Usage Chage a where (a.Center like '%". str_replace(" ","",$_POST["center_no"]) ."%') order by a.Month
ตรงชื่อ tabel ใช่ เป็น TB_ALL_Usage Chage หรือ TB_ALL_UsageChage
เคดิต: http://99tarad.com/2012/category/php-mysql/
Date :
2012-02-09 00:53:42
By :
มะเดี่ยวศรี
Load balance : Server 05