连接数据库
时间:2011-04-28 来源:雁过无痕
一、include ("../adodb5/adodb.inc.php");
$db=NewADOConnection('mysql');
$db->Connect("localhost","root","123456","db_shop") or die("数据库连接失败!!") ;
$db->Execute("set names 'GBK'");
二、include ("../adodb5/adodb.inc.php");
$db->NewADOConnection('mysql://root:123456@localhost/db_shop');
$sql=select * from 'db_common';
$db->SetFetchMode(ADODB_FETCH_NUM); //ADODB_FETCH_ASSOC
$sr1=$db->Execute($sql);
print_r($sr1->fields);
三、include ("../adodb5/adodb.inc.php");
$db->NewADOConnection('mysql');
$db->PConnect("localhost","root","123456","db_shop");
$sql=select * from 'db_common';
$sr1=$db->Execute($sql);
while($row=$sr1->FetchNextObject()){
print_r($row);
}
分页
include_once();
$db->NewADOConnect('mysql');
$db->Connect("localhost","root","123456","db_shop") ;
$sql=select * from 'db_common';
$sr1=$db->Execute($sql);
echo rs2html($rs1);
相关阅读 更多 +