<?PHP $perpage=4; $strcnn=mysql_connect("localhost","root","");
mysql_select_db("data",$strcnn); $qs="select * from sinhvien";
$result=mysql_query($qs); $total=mysql_num_rows($result);
// tong so ban ghi echo("tong ban ghi :".$total."<br>");
$numofpage=ceil($total/$perpage);//lam tron so trang
if($_GET['page']=="") {//kiem tra $x=0; }
else{ $x=($_GET["page"]-1)*$perpage; }
$qs1="select * from sinhvien limit $x,$perpage";
//khoang ban ghi can lay $result1=mysql_query($qs1);
while($row1=mysql_fetch_array($result1)) {
echo("id: ".$row1['id']."hoten ".$row1['ten']."<br>"); }
echo "trang :"; for($i=1;$i<=$numofpage;$i++)
{ echo("<a href=bai10.php?page=".$i.">".$i."</a>".""); }
echo("<br>"); ?> $lui=($_GET["page"]-1); $tien=($_GET["page"]+1);
if($tien<=$numofpage) { echo("<a href=bai10.php?page=".$tien.">tien</a>"); }
if($lui>0&&$lui<$numofpage) { echo("<a href=bai10.php?page=".$lui.">lui</a>"); }
7/06/2009
Subscribe to:
Post Comments (Atom)
List
Profiles Information
About me : Nothing is 1 vài thứ - 1985
Places I've Lived : I ♥ Hà Nội
Home Page : http://www.shimivn.blogspot.com/
Think : 1:1000000000
Languages spoken : Vietnamese,English.
Mobile : sony C2305 ♥ ♥
dell : i3-Ram 3GB- HDD 250GB . ♥♥♥
Places I've Lived : I ♥ Hà Nội
Home Page : http://www.shimivn.blogspot.com/
Think : 1:1000000000
Languages spoken : Vietnamese,English.
Mobile : sony C2305 ♥ ♥
dell : i3-Ram 3GB- HDD 250GB . ♥♥♥
No comments: