ADODB的应用

<?php

 include_once (‘adodb5/adodb.inc.php‘);
 $db = NewADOConnection (‘mysql‘);
 $db->Connect("localhost", "root", "", "php100")or die("错误");
 $db->Execute("set names ‘UTF8‘");
 $query=$db->execute("select * from `php100`");
 while($row=$query->FetchRow()){
 print_r($row);
 }
 ?>

 

<?php

include_once (‘adodb5/adodb.inc.php‘);
 $db = NewADOConnection (‘mysql‘);
 $db->Connect("localhost", "root", "", "php100")or die("错误");
 $db->Execute("set names ‘UTF8‘");
 
 $arr=array(
 "name"=>"patzi",
 "hit"=>"111"
 );
 $db->AutoExecute("php100",$arr,"INSERT") 
?>

 

<?php
 include_once (‘adodb5/adodb.inc.php‘);
 $db = NewADOConnection(‘mysql://root:@localhost/php100‘);
 $db->Execute("set names ‘UTF8‘");
 $sql="select * from `php100`";
 $db->SetFetchMode(ADODB_FETCH_ASSOC);
 $sr1 = $db->Execute($sql);
 print_r($sr1->fields);


 $db = NewADOConnection (‘mysql‘);
 $db->Connect("localhost", "root", "", "php100")or die("错误");
 $db->Execute("set names ‘UTF8‘");
 $query=$db->execute("select * from `php100`");
 while($row=$query->fetchnextobject()){
 echo $row->NAME;
 }


 include_once (‘adodb5/tohtml.inc.php‘);
 $db = NewADOConnection (‘mysql‘);
 $db->Connect("localhost", "root", "", "php100")or die("错误");
 $db->Execute("set names ‘UTF8‘");
 $query=$db->execute("select * from `php100`");
 echo rs2html($query);
 
 
 include_once (‘adodb5/adodb-pager.inc.php‘);
 session_start();
 $db = NewADOConnection(‘mysql://root:@localhost/php100‘);
 $db->Execute("set names ‘UTF8‘");
 $sql="select * from `php100`";
 $pager=new adodb_pager($db,$sql);
 $pager->render(3);
 ?>

ADODB的应用,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。