สอบถามเรื่อง Fatal error: Uncaught exception 'com_exception' with message ค่ะ
ขอถามหน่อยค่ะ มันขึ้น error แบบนี้อ่ะค่ะ
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] Characters found after end of SQL statement.' in C:\AppServ\www\PCrent\PCRental_App\Report1.php:111 Stack trace: #0 C:\AppServ\www\PCrent\PCRental_App\Report1.php(111): com->Open('SELECT tb_Cente...', Object(com), 1, 3) #1 {main} thrown in C:\AppServ\www\PCrent\PCRental_App\Report1.php on line 111
โค้ดที่เขียน (จะทำการค้นหาข้อมูลอ่ะค่ะ)
Code (PHP)
<?php ob_start();
include "connect.php";
$conn->open($msaccdb);
?>
<!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" src="javascriptfile/jquery.js"></script>
<script type="text/javascript" src="javascriptfile/jquery.nyroModal.custom.js"></script>
<script type="text/javascript" src="javascriptfile/jquery.rsv.js"></script>
<script type="text/javascript" src="javascriptfile/jqueryuiredmond.js"></script>
<script type="text/javascript" src="javascriptfile/jquery.dataTables.js"></script>
<script type="text/javascript" src="javascriptfile/manage_butt.js"></script>
<link rel="stylesheet" type="text/css" href="cssfile/nyroModal.css" />
<link rel="stylesheet" type="text/css" href="cssfile/redmond/jqueryuiredmond.css" />
<link rel="stylesheet" type="text/css" href="cssfile/mancost_page.css" />
<link rel="stylesheet" type="text/css" href="cssfile/mancost_tb_jqui.css" />
<script type="text/javascript">
$(function(){
$( "#submit_cost" ).button();
$( "#Summit_CF" ).button();
$.get('listcontract.php', {ID_Purchase: $('[name="radio_cost"]:checked').val()}, function(datab){
$('#selcontract').append('<option value="">กรุุณาเลือกสัญญา</option>');
for (i=0; i<datab.maxreccon; i++)
{
$('#selcontract').append('<option value='+datab.ID_Contract_all[i]+'>'+datab.Contract_No[i]+'</option>');
}
}, 'json');
$('#cost_table').dataTable({
"bJQueryUI": true,
"bPaginate": false,
"bProcessing": true,
"aoColumnDefs": [
{"bSortable": false, "aTargets": [0]}
],
"aaSorting": [[1, "asc"]]
});
}); //close Jquery
</script>
<style type="text/css">
TR:nth-child(odd) {
background-color: #FFFFFF;
}
TR:nth-child(even) {
background-color: #CCCCFF;
}
table
{
border: #CCCCFF;
}
</style>
</head>
<body on id="manage_cost">
<div id="head_info">
<h1>รายงานสรุปข้อมูลการเช่า</h1>
</div>
<div align="center" id="search_cenfunc">
<form method="get" name="form_CF" id="form_CF" target="_blank">
<br /><br />
<b>กรุณาเลือกสัญญา</b>
<select name="selcontract" id="selcontract"></select>
<button type="submit" name="Summit_CF" id="Summit_CF" value="ค้นหา">ค้นหา</button>
</form>
</div>
<?php
if (isset($_GET['Summit_CF']))
{
?>
<div id="cost_tb" name="cost_tb">
<center>
<h1>รายงานสรุปข้อมูลการเช่าตามสัญญาเช่า</h1>
</center>
<table align="center" border="1">
<thead>
<tr>
<th rowspan="3" class="ui-state-default">CenterNo.</th>
<th rowspan="3" class="ui-state-default">Functionname</th>
<th rowspan="3" class="ui-state-default">Equipment_Type</th>
<th rowspan="3" class="ui-state-default">Budget_New</th>
<th rowspan="3" class="ui-state-default">Budget_Replace</th>
<th rowspan="3" class="ui-state-default">Budget_Price</th>
<th rowspan="3" class="ui-state-default">ราคาเช่าต่อเดือน</th>
<th rowspan="3" class="ui-state-default">ราคาเช่าต่อปี</th>
<th rowspan="3" class="ui-state-default">ราคาเช่าต่อ 3 ปี</th>
</tr>
<tr>
<th class='ui-state-default'><? echo $_GET['selcontract']; ?></th>
</tr>
<tr>
<?php
$str2 = "SELECT tb_Center.CenterNo, tb_Function.Function_Name, tb_Contract.Contract_No,tb_Equipment_Type.Equipment_Type, tb_Purchase.Budget_New,
tb_Purchase.Budget_Replace, tb_Equipment.Budget_Price
FROM (tb_Function INNER JOIN (tb_Center_Function INNER JOIN tb_Center ON tb_Center_Function.ID_Center = tb_Center.ID_Center)
ON tb_Function.ID_Function = tb_Center_Function.ID_Function)
INNER JOIN ((tb_Equipment_Type INNER JOIN (tb_Contract INNER JOIN tb_Equipment ON tb_Contract.ID_Contract = tb_Equipment.ID_Contract)
ON tb_Equipment_Type.ID_Equipment_Type = tb_Equipment.ID_Equipment_Type) INNER JOIN tb_Purchase ON tb_Equipment.ID_Equipment = tb_Purchase.ID_Equipment)
ON tb_Function.ID_Function = tb_Purchase.ID_Function; = ".$_GET['selcontract']."";
$Rec->Open($str2, $conn, 1, 3);
while (!$Rec->EOF)
{
$CenterNo[] = $Rec->Fields['tb_Center.CenterNo']->Value;
$Functionname[] = $Rec->Fields['tb_Function.Function_Name']->Value;
$Equipment_Type[] = $Rec->Fields['tb_Equipment_Type.Equipment_Type']->Value;
$Budget_New[] = $Rec->Fields['tb_Purchase.Budget_New']->Value;
$Budget_Replace[] = $Rec->Fields['tb_Purchase.Budget_Replace']->Value;
$Budget_Price[] = $Rec->Fields['tb_Equipment.Budget_Price']->Value;
$Rec->MoveNext();
}
$Rec->Close();
?>
<th > </th> <?php } ?>
</tr>
</thead>
<tbody>
<tr >
<td><? echo $CenterNo; ?></td>
<td><? echo $Functionname; ?></td>
<td><? echo $Equipment_Type; ?></td>
<td><? echo $Budget_New; ?></td>
<td><? echo $Budget_Replace; ?></td>
<td><? echo $Budget_Price; ?></td>
<td align="center"><? if($ID_Equipment[$i]== $ID_Equipments){
$purches = $actnew+$actre+$actrecon;
if($actnew+$actre+$actrecon == 0){ $purches = $budgetnew+$budgetre+$budgetrecon; }
echo $purches;
$TotalDivice[$i] = $purches + $TotalDivice[$i];
} ?></td>
<td align="right"><? for($i=0;$i<$maxloop;$i++){
if($ID_Equipment[$i]== $ID_Equipments){
$RentMonth = $purches*$price[$i];}
}
echo number_format($RentMonth);
$TotalMonth[$i] = $RentMonth + $TotalMonth[$i]; ?></td>
<td align="right"><? $RentYear = $RentMonth*12;
echo number_format($RentYear);
$TotalYear[$i] = $RentYear + $TotalYear[$i];?></td>
<td align="right"> </td>
</tr>
<tr >
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<?
$TotalDivice[] = 0;
$TotalMonth[] = 0;
$TotalYear[] = 0;
$Total3Year[] = 0;
for($i=0;$i<$maxloop;$i++){ ?>
<td align="center"><? echo number_format($TotalMonth[$i]); ?></td>
<? } ?>
<td align="right"><? echo number_format($TotalYear[$i]); ?></td>
<td align="right"><? echo number_format($Total3Year[$i]); ?></td>
<td align="right"><? $Rent3Year = $RentYear*3;
echo number_format($Rent3Year);
$Total3Year[$i] = $Rent3Year + $Total3Year[$i];?></td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="2" align="center"></td>
<? for($i=0;$i<$maxloop;$i++){ ?>
<td align="center" bgcolor="#FFFF00"> </td>
<? } ?>
<td align="right" bgcolor="#FFFF00"> </td>
<td align="right" bgcolor="#FFFF00"> </td>
<td align="right" bgcolor="#FFFF00"> </td>
</tr>
</tfoot>
</table>
</div>
<?php
?>
</body>
</html>
Tag : Ms Access, HTML/CSS, JavaScript, Report Others, Windows
ประวัติการแก้ไข 2012-08-15 10:56:32
Date :
2012-08-15 10:53:55
By :
mah_comsci
View :
996
Reply :
1
Code (PHP)
echo $str2;
เอาค่ามาดูหน่อยครับ
Date :
2012-08-15 13:57:32
By :
mr.win
Load balance : Server 04