<?php
$sql ="select * from student order by id asc ";
1.select * from student หมายถึงเลือกทุก field จาก student
2. asc ใช้เก็บข้อมูลจากน้อยไปมากเช่น 1-10 ,a-z,ก-ฮ
$query=mysql_query($sql) or die(mysql_error());
3.ใช้ในการประมวลคำสั่ง sql หรือใช้ในการตรวจสอบ or die ว่า error หรือไม่ เวลาเปลี่ยนให้เปลี่ยนเเค่ชื่อ table and field เท่านั้น
$num=mysql_num_rows($query);
4. นับค่าจำนวน record ที่ใส่ใน num เวลาที่เขียนตัวแปลจะต้องเขียนให้ตรงกันไม่เช่นนั้น จะไม่แสดง คำสั่ง
echo $num; $num และecho$num
5.แสดงจำนวน record
?>