นี่คือ error ที่ฟ้องค่ะ Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\cdb\search.php on line 84
Code (PHP)
<?
if($_GET["txtKeyword"] != "")
{
require_once('config.inc.php');
$sql = "select * from $tblname
left join $tblname2 on $tblname.company_id=$tblname2.company_id
left join $tblname3 on $tblname.company_id=$tblname3.company_id ";
$dbquery = mysql_db_query($dbname, $sql);
// Search By Name or Email
$strSQL = "SELECT * FROM $tblname left join $tblname2 on $tblname.company_id=$tblname2.company_id
WHERE (regist_date LIKE '%".$_GET["txtKeyword"]."%' or company_name LIKE '%".$_GET["txtKeyword"]."%'
or status_comp LIKE '%".$_GET["txtKeyword"]."%'
or com_stat LIKE '%".$_GET["txtKeyword"]."%'
or commercial_id LIKE '%".$_GET["txtKeyword"]."%'
)";
$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 company_id ASC LIMIT $Page_Start , $Per_Page";
$dbquery = mysql_query($strSQL);
?>
<table width="972" border="1">
<tr>
<th width="77"> <div align="center">ID </div></th>
<th width="170"> <div align="center">Name </div></th>
<th width="121"> <div align="center">commercial ID </div></th>
<th width="211"> <div align="center">Detail</div></th>
<th width="103"> <div align="center">Regist Date</div></th>
<th width="102"> <div align="center">สถานะทั่วไป</div></th>
<th width="67"> <div align="center">status</div></th>
<th width="69"> <div align="center">เรียกดู</div></th>
<th width="69"> <div align="center">แก้ไข</div></th>
</tr>
<?
while($objResult = mysql_fetch_array($dbquery)) <<< บรรทัดที่ 84 ค่ะ
{
?>
<tr>
<td><div align="center"><?=$objResult["company_id"];?></div></td>
<td><?=$objResult["company_name"];?></td>
<td><div align="center"><?=$objResult["commercial_id"];?></div></td>
<td align="right"><?=$objResult["detail"];?></td>
<td><div align="center"><?=$objResult["regist_date"];?></div></td>
<td><div align="center"><?=$objResult["status_comp"];?></div></td>
<td><div align="center"><?=$objResult["com_stat"];?></div></td>
<td><div align="center"><? $id = $objResult ['company_id'];
print "<a href='detailf.php?id=$id'>ดู</a>";
?></div></td>
<td><div align="center"><? $id = $objResult ['company_id'];
print "<a href='editf.php?id=$id'>แก้ไข</a>";
?></div></td>
</tr>
<?
}
?>