ADODBを使ってのPHPでのデータベース取り扱い

1.ADODB PHPの高速検索機能
include_once(“adodb5/adodb.inc.php");
$db = &NewADOConnection('mysql’);
$db->Connect(“localhost", “root", “", “db")or die(“エラー");
$db->Execute(“set names 'UTF-8′");

$q=$db->Execute(“select * from up_admin_user");

while($row=$q->FetchRow()){
print_r($row);
}
参考コード:

<?php
include_once(“adodb5/adodb.inc.php");
$db = NewADOConnection('mysql’);
$db->Connect('localhost’, 'root’, ", 'think_zw’)or die(“error"); //MySQLに接続
$db->Execute(“set names 'UTF-8′");
$query=$db->Execute(“select * from think_zw");
while($row=$query->FetchRow()){
print_r($row);
}
?>
2.データをインテリジェント挿入
include_once(“adodb5/adodb.inc.php");

$db = &NewADOConnection('mysql’);
$db->Connect(“localhost", “root", “", “db")or die(“エラー");
$db->Execute(“set names 'UTF-8′");

$arr=array('m_id’=>’2′,’password’=>’333333’,’33333’=>’4444444‘);
$db->AutoExecute(“up_admin_user",$arr,"INSERT");
参考コード:
<?php
include_once(“adodb5/adodb.inc.php");
$db = NewADOConnection('mysql’);
$db->Connect('localhost’, 'root’, ", 'think_zw’)or die(“error"); //MySQLに接続
$db->Execute(“set names 'UTF-8′");
$arr=array(“id"=>"",
“name"=>"次郎",
“details"=>"次郎のことが大好きです");
$db->AutoExecute(“think_zw",$arr,"INSERT");
$query=$db->Execute(“select * from think_zw");
while($row=$query->FetchRow()){
echo $row[name]."<br>";
}
?>

Source

Posted by arkgame