PHP Connect Access database and modify delete Add data instance _php tutorial

Source: Internet
Author: User
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

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.