-
Notifications
You must be signed in to change notification settings - Fork 0
データベース
ateliee edited this page Oct 27, 2015
·
1 revision
mysqlのみ対応。MYSQL,MYSQLI
$c_database = new class_mysql();
$c_database->addDB('localhost','root','pass');
$c_database->setCurrentDB(0);
$c_database->get()->setDBName('database_name');
$c_database->get()->setCharset('utf8');
// connect auto
$c_database->setAutoConnect(true);
// debug mode
$c_database->setDebug(true);
// sql create
$sql = "SELECT COUNT(*) FROM `test` ";
// query
$c_database->query($sql);
if($DB->numRows() > 0){
$sv = $DB->fetchArray();
}
$sql = "SELECT COUNT(*) FROM `:table:` ";
$sql .= "WHERE `id`=:%id%: ";
$c_database->execute($sql,array('id' => $id,'table'=>'test'));
$sqlvalue = $DB->fetchResults();
$c_database->updateRecodeSQL('test',array('name' => 'change name'),'where id=1');
$c_database->insertRecodeSQL('test',array('name' => 'change name'));
$c_database->insertRecodeSQL('test','where id=1');
$c_sql = new class_sql();
$c_sql->escapeSQL($str);
$c_database->escapeSQL($str);