พี่ๆ ช่วยหน่อยครับผม พี่มันติด Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\webboard\show_ans.php on line 13
$id_quiz น่าจะไม่มีค่านะครัน ไออ่านเรื่ง $_GET $_POST ซะหน่อยก็จะดีไม่น้อยครับ
Date :
2012-01-27 12:50:11
By :
ikikkok
<body>
<?php
$con = mysql_connect("localhost","root","1234");
$avsalary=0;
$count =0;
$dbName="peple";
$charset = "SET character_set_results=utf8";
mysql_query($charset)or die('invalid query :'.mysql_error());
mysql_select_db($dbName,$con)or die("ไม่สามารถเข้าใช้ฐานข้อมูลได้");
$key=$_POST['txtSearch'];
echo $key;
$query="SELECT staff.staffId, staff.name, staff.lastname,department.depName,staff.age,staff.salary,staff.gender
FROM staff, department
WHERE staff.departmentId = department.departmaentId";
$result=mysql_query($query,$con);
echo "<table border=\"2\"align=\"center\">
<tr><td>StaffID</td></td><td>Name</td><td>LastName</td><td>Gender</td><td>Department</td><td>Age</td><td>Salary</td></tr>";
while($row=mysql_fetch_array($result))
{
echo "<tr><td>$row[staffId]</td><td>$row[name]</td><td>$row[lastname]</td><td>$row[gender]</td><td>$row[depName]</td><td>$row[age]</td><td>$row[salary]</td></tr>";
if($row[gender] == 'M')
{
$count +=1;
}
}
echo "</table>";
echo $count;
mysql_close($con);
?>
</body>
</html>
มันขึ้นว่า mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\work\work6.php on line 26 ช่วยที่ครับ
Date :
2012-03-05 11:07:48
By :
aod
Load balance : Server 03