<?php
$objConnect = mysql_connect("localhost","root","") or die("Error Connect to Database");
$objDB = mysql_select_db("project");
$strSQL = "select sum(wk_sum) as wk_sum, sum(ot_sum) as ot_sum , wk_month ,per_id , per_name , wk_year, wk_code FROM work group by per_id ,wk_month WHERE wk_code = '".$_GET["wk_code"]."' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
if(!$objResult)
{
echo "Not found wk_code=".$_GET["wk_code"];
}
else
{
?>
ฟ้องว่า
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\test\add_salary.php on line (บรรนี้ คือ $objResult = mysql_fetch_array($objQuery);) อ่ะครับ
Not found wk_code=35
$strSQL = "select sum(wk_sum) as wk_sum, sum(ot_sum) as ot_sum , wk_month ,per_id , per_name , wk_year, wk_code FROM work WHERE wk_code = '".$_GET["wk_code"]."' GROUP BY per_id ,wk_month ";
$strSQL = "select sum(wk_sum) as wk_sum, sum(ot_sum) as ot_sum , wk_month ,per_id , per_name , wk_year, wk_code FROM work WHERE per_id = '".$_GET["per_id"]."',wk_month= '".$_GET["wk_month"]."' GROUP BY per_id ,wk_month";