PHP Tutorial Connect Access database tutorial with modify delete add data instance
This article provides a PHP connection to access database and modify Delete add data instance Oh, home we tell you to use PHP to connect to access database and then add, modify, edit, display delete and data paging effect source code.
*/
$conn = new COM ("Adodb.connection");
$conn->open ("Driver={microsoft Access Driver (*.mdb)}; Dbq= ". Db_path."; uid=;p wd=; ");
$rs =new com ("Adodb.recordset");
$rs->open ("select * from [Article] ORDER BY [ArticleID]", $conn, 1, 3);
$rs->pagesize=5;
$page =trim ($_get[' page ');
if ($page = = "" | | is_numeric (intval ($page)) <=0) {$page = 1;} else if (intval ($page) > $rs->pagecount) {$page = $rs->pagecount;}
$page =intval ($page);
if (! $rs->eof| | $rs->bof) {
$rs->absolutepage= $page; $mypagesize = $rs->pagesize; $i = $rs->recordcount ()-($page-1) * $rs->pagesize;
while (! $rs->eof && $mypagesize >0 && $i >= $rs->recordcount ()-$rs->pagesize* $page) {
$articleid = $rs->fields (0)->value;
$articletitle = $rs->fields (1)->value;?>
">
MoveNext $mypagesize--; $i--; }}?>
Header page 1) {echo $page-1;} Else{echo 1;}? > "> Prev pagecount) {echo $page +1;} Else{echo $rs->pagecount;}? > "> Next page pagecount;? > "> Last Total RecordCount ();?> articles, minutes PageCount;? The > page shows that it is now the first Page