ปัญหา Warning: mysql_num_rows(): supplied argument is not a

สำหรับผู้ที่ เริ่มต้น Programming - PHP มีอะไร แนะนำ หรือข้อสงสัยต้องบอร์ด นี้ คนที่มีความรู้ แบ่งปันคนอื่นบ้างนะ ปัญหาการเขียนโปรแกรม แบบ OOP Session Cookies php network

Moderator: mindphp, ผู้ดูแลกระดาน

์Narenat

Re: WoWarning: mysql_num_rows(): supplied argument is not a vali

โพสต์ที่ยังไม่ได้อ่าน โดย ์Narenat »

<?php
/*$answer1 = $_POST['1'];// รับค่าคำตอบ้อที่ 1
$answer2 = $_POST['2'];// รับค่าคำตอบ้อที่ 1
*/
$score=0;//เก็บคะแนนที่ทำได้
foreach($_POST as $choice=>$answer){

if ($chioce!='btnSend'){
$sql="Select id From tb_choice_reading Where id = {$choice} and answer = {$answer}";
$rs = mysql_query($sql);
if(mysql_num_rows($rs)==1){//แสดงว่าตอบถูก echo mysqlerror()
$score++;// เพิ่มคะแนน
}
echo 'ข้อ:',$choice, 'ตอบ',$answer,'<br/>';
}
}
$pass='ไม่ผ่าน';
if($score>=5){// ตรวจสอบคะแนนที่ได้ผ่านหรือไม่
$pass='ผ่าน';
}
echo 'คะแนนที่ทำได้',$score,'คะแนน';
echo'<br/>ผลการทดสอบ:',$pass;
?>
ตอบกลับโพส
  • Similar Topics
    ตอบกลับ
    แสดง
    โพสต์ล่าสุด

ผู้ใช้งานขณะนี้

สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 116