|
|
|
ติดปัญหา Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource ครับ |
|
|
|
|
|
|
|
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\ithelpdesk\index.php on line 84
Code (PHP)
<!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" />
<META content="text/html; charset=utf-8" http-equiv=Content-Type>
<link rel="icon" href="images/etc/favicon.ico" type=”image/x-icon” />
<link href="css/screen.css" rel="stylesheet" type="text/css" media="screen" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<script src="js/jquery1.7.1.js" type="text/javascript"></script>
<script src="js/main6.js" type="text/javascript"></script>
<script src="js/ga_social_tracking.js" type="text/javascript"></script>
<title>ระบบแจ้งซ่อมคอมพิวเตอร์ออนไลน์ IT SUPPORT THANES DEVELOPMENT</title>
</head>
<div class=" shadow">
<div id="header"><? include "head.php"; ?>
</div>
<div id="mainmenu">
<? include "menu.php"; ?>
</div>
<div id="con"></div>
<?
$objConnect = mysql_connect("localhost","root","1234") or die("Error Connect to Database");
$objDB = mysql_select_db("request");
mysql_query("SET NAMES 'tis620'");
mysql_query("SET NAMES UTF8");
$strSQL = "SELECT * FROM job";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$Num_Rows = mysql_num_rows($objQuery);
$Per_Page = 10; // Per Page
$Page = $_GET["Page"];
if(!$_GET["Page"])
{
$Page=1;
}
$Prev_Page = $Page-1;
$Next_Page = $Page+1;
$Page_Start = (($Per_Page*$Page)-$Per_Page);
if($Num_Rows<=$Per_Page)
{
$Num_Pages =1;
}
else if(($Num_Rows % $Per_Page)==0)
{
$Num_Pages =($Num_Rows/$Per_Page) ;
}
else
{
$Num_Pages =($Num_Rows/$Per_Page)+1;
$Num_Pages = (int)$Num_Pages;
}
$strSQL .=" order by CustomerID ASC LIMIT $Page_Start , $Per_Page";
$objQuery = mysql_query($strSQL);
?>
<table width="100%" border="1" cellpadding="0">
<tr>
<th width="76"bgcolor="#88D5E7"> <div align="center">เลขที่</div></th>
<th width="214"bgcolor="#88D5E7"> <div align="center">ผู้แจ้ง</div></th>
<th width="69"bgcolor="#88D5E7"> <div align="center">รหัสพนักงาน</div></th>
<th width="132"bgcolor="#88D5E7"> <div align="center">แผนก</div></th>
<th width="71"bgcolor="#88D5E7"> <div align="center">เบอร์ภายใน</div></th>
<th width="108"bgcolor="#88D5E7"> <div align="center">วันที่แจ้ง</div></th>
<th width="150"bgcolor="#88D5E7"> <div align="center">ความต้องการ</div></th>
<th width="102"bgcolor="#88D5E7"> <div align="center">รายละเอียด</div></th>
<th width="83"bgcolor="#88D5E7"> <div align="center">สถานะ </div></th>
</tr>
<?
while($objResult = mysql_fetch_array($objQuery))
{
$y=substr($job_date,2,2);
$m=substr($job_date,5,2);
$d=substr($job_date,8,2);
$job_id = $objResult["job_id"];
$code=sprintf("$y$m%05d",$job_id);
?>
<tr>
<td width="214"><?=$objResult["job_fnameEng"];?> <?=$objResult["job_lnameEng"];?></td>
<td width="69"><?=$objResult["per_id"];?></td>
<td width="108">
<?
$dep_id = $objResult["job_dep_id"];
?>
<?
$strSQL3 ="SELECT * FROM dep where dep_id='$dep_id' ";
$objQuery3 = mysql_query($strSQL3);
$Num_Rows3 = mysql_num_rows($objQuery3);
while($objResult3 = mysql_fetch_array($objQuery3))
{
?>
<div align="center"><?=$objResult3["dep_name"];?></div></td>
<?
}
?>
</td>
<td width="132"><?=$objResult["job_tel"];?></td>
<td width="71"><?=$objResult["job_date"];?>[<?=$objResult["job_time"];?>]</td>
<td width="150">
<?
$dep_id = $objResult["job_type_id"];
?>
<?
$strSQL3 ="SELECT * FROM type where type_id='$type_id' ";
$objQuery3 = mysql_query($strSQL3);
$Num_Rows3 = mysql_num_rows($objQuery3);
while($objResult3 = mysql_fetch_array($objQuery3))
{
?>
<div align="center"><?=$objResult3["type_name"];?></div></td>
<?
}
?>
</td>
<td width="102"><?=$objResult["job_detail"];?></td>
<td width="83"><?=$objResult["job_status"];?></td>
</tr>
<?
}
?>
</table>
<br>
Total <?= $Num_Rows;?> Record : <?=$Num_Pages;?> Page :
<?
if($Prev_Page)
{
echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'><< Back</a> ";
}
for($i=1; $i<=$Num_Pages; $i++){
if($i != $Page)
{
echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i'>$i</a> ]";
}
else
{
echo "<b> $i </b>";
}
}
if($Page!=$Num_Pages)
{
echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page'>Next>></a> ";
}
mysql_close($objConnect);
?>
<p> </p>
</div>
<div class="clear"></div>
</div></div>
<div class="bottombar2">
<table width="950">
<tr>
<td width="299"> </td>
<td width="336"> </td>
<td width="299"> </td>
</tr>
</table>
<p> </p>
</div>
</body></html>
มันบอก Query was empty
ขอบคุณครับ
Tag : PHP, HTML/CSS, JavaScript
|
|
|
|
|
|
Date :
2013-06-21 16:46:03 |
By :
ruud |
View :
669 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
เงื่อนไข order by อะครับ บรรทัดที่ 65 ฐานข้อมูลของคุณมีฟิลด์ CustomerID หรือเปล่าเพราะดูแล้วเหมือน code ต้นฉบับเลย
|
|
|
|
|
Date :
2013-06-21 16:57:28 |
By :
Manussawin |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|