Home > Backend Development > PHP Tutorial > PHP connection access database and modification delete add data instance_PHP tutorial

PHP connection access database and modification delete add data instance_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 17:05:26
Original
913 people have browsed it

php tutorial connection access database tutorial and modification delete add data instance
This article provides an example of how to use PHP to connect to the access database and modify, delete and add data. On the home page, we will tell you how to use PHP to connect to the access database and then add, modify, edit, display, delete and paginate the data source code.
*/

$conn = new com("adodb.connection");
$conn->open("driver={microsoft access driver (*.mdb)}; dbq=".db_path.";uid=;pwd=;");

$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()-1-$rs->pagesize*$page){
$articleid = $rs->fields(0)->value;
$articletitle = $rs->fields(1)->value; ?>

  • < ? echo $articlei; ?>

  • movenext; $mypagesize--; $i--; } } ?>




    Head page Previous page next page Last page  Totalrecordcount(); ?>Articles, divided into< ? echo $rs->pagecount;?> page is displayed, now it is page

    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Latest Issues
    php data acquisition?
    From 1970-01-01 08:00:00
    0
    0
    0
    PHP extension intl
    From 1970-01-01 08:00:00
    0
    0
    0
    How to learn php well
    From 1970-01-01 08:00:00
    0
    0
    0
    Popular Recommendations
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template