<?php
$objConnect = mysql_connect("localhost","root","12345");
$objDB = mysql_select_db("db_conn");
$strSQL = "SELECT * FROM plant WHERE
(pnt_id LIKE '%".$strKeyword."%'
OR family_id LIKE '%".$strKeyword."%'
OR pnt_date LIKE '%".$strKeyword."%'
OR pnt_comm_name LIKE '%".$strKeyword."%'
OR pnt_sci_name LIKE '%".$strKeyword."%'
OR pnt_vernac_name LIKE '%".$strKeyword."%'
OR pnt_synonym_name LIKE '%".$strKeyword."%'
OR pnt_info LIKE '%".$strKeyword."%'
OR pnt_benefit LIKE '%".$strKeyword."%') UNION
SELECT * FROM tree WHERE
(tree_coor LIKE '%".$strKeyword."%' )";
$objQuery = mysql_query($strSQL);
$intNumField = mysql_num_fields($objQuery);
$resultArray = array();
while($obResult = mysql_fetch_array($objQuery))
{
$arrCol = array();
for($i=0;$i<$intNumField;$i++)
{
$arrCol[mysql_field_name($objQuery,$i)] = $obResult[$i];
}
array_push($resultArray,$arrCol);
}
echo mysql_error();
mysql_close($objConnect);
echo json_encode($resultArray);
?>
อันนี้เป็น error ที่แสดงคับ
Code
Warning: mysql_num_fields(): supplied argument is not a valid MySQL result resource in D:\AppServ\www\include2\search.php on line 48
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in D:\AppServ\www\include2\search.php on line 50
The used SELECT statements have a different number of columns[]