<?php
$sql ="select * from student order by id asc ";
// กำหนดตัวแปร $sql เลือกทุกฟิลล์จากตารางชื่อ student
โดยจัดเรียงข้อมูล id จากน้อยไปมาก
$query=mysql_query($sql) or
die(mysql_error());
// กำหนดตัวแปร query
รับค่าตัวแปร $sql
และตรวจสอบคำสั่ง
$num=mysql_num_rows($query);
// นับจำนวน record จากคำสั่ง sql จากตาราง student
เก็บค่าไว้ในตัวแปร num
echo $num;
// แสดงจำนวน
record
?>
No comments:
Post a Comment