簡単なページングストレージプロセスphp mysql mysqli拡張

987 ワード

create database cunchu;
use cunchu;
set names gbk;
create table member(
id int(8) unsigned primary key auto_increment,
name varchar(50) not null,
email varchar(50) not null
) engine=myisam;

insert into member(name,email) values('xiaoming','[email protected]');
insert into member(name,email) values('  ','[email protected]');
//      
 CREATE PROCEDURE  cun11(beg int,en int)
 BEGIN
  select * from member order by id desc limit beg,en; 
 END$$
//  
<?php 

$dblink=new mysqli('localhost','root','root','cunchu');
$dblink->query('set names gbk');
if($result=$dblink->query("call cun11(1000,20)")){
 while($row=$result->fetch_array())
 {
  echo $row['id']."===========".$row['name']."-------".$row["email"].'<br/>';
 }
}
?>