本文整理匯總了PHP中DBQuery::prepareInsert方法的典型用法代碼示例。如果您正苦於以下問題:PHP DBQuery::prepareInsert方法的具體用法?PHP DBQuery::prepareInsert怎麽用?PHP DBQuery::prepareInsert使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DBQuery
的用法示例。
在下文中一共展示了DBQuery::prepareInsert方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: insertCompany
function insertCompany($company_name)
{
$q = new DBQuery();
$q->addTable("companies");
$q->addInsert('company_name', $company_name);
db_exec($q->prepareInsert());
return db_insert_id();
}
示例2: testInsertBD
function testInsertBD()
{
$q = new DBQuery();
$q->addTable('eap');
$q->addQuery("id,nome,linha,coluna");
$q->addInsert(nome, 'Build Teste');
$q->addInsert(linha, 2);
$q->addInsert(coluna, 3);
$q->prepareInsert();
$this->assertEqual($q->exec(), true);
$q->clear();
}
示例3: die
<?php
if (!defined('DP_BASE_DIR')) {
die('You should not access this file directly. Instead, run the Installer in install/index.php.');
}
dPmsg('Converting users to contacts');
$q = new DBQuery();
$q->addTable("users");
$q->addQuery("*");
$users = db_loadList($q->prepare(true));
$flds = array('contact_first_name', 'contact_last_name', 'contact_birthday', 'contact_company', 'contact_department', 'contact_email', 'contact_phone', 'contact_phone2', 'contact_mobile', 'contact_address1', 'contact_address2', 'contact_city', 'contact_state', 'contact_zip', 'contact_country', 'contact_icq', 'contact_icon', 'contact_owner');
foreach ($users as $user) {
$vals = array($user['user_first_name'], $user['user_last_name'], $user['user_birthday'], (int) dPgetParam($user, 'user_company', 0), (int) dPgetParam($user, 'user_department', 0), $user['user_email'], $user['user_phone'], $user['user_home_phone'], $user['user_mobile'], $user['user_address1'], $user['user_address2'], $user['user_city'], $user['user_state'], $user['user_zip'], $user['user_country'], $user['user_icq'], $user['user_pic'], $user['user_owner']);
$q->addTable('contacts');
$q->addInsert($flds, $vals, true);
db_exec($q->prepareInsert());
$q->clear();
$msg = db_error();
$vals = array($user['user_id'], 'USERFORMAT', 'user');
$q->addTable('user_preferences');
db_exec($q->addInsert($flds, $vals, true));
$q->clear();
$msg = db_error();
if ($msg) {
dPmsg($msg);
}
$q->addTable('users');
$q->addUpdate('user_contact=LAST_INSERT_ID()');
$q->addWhere('user_id = ' . $user['user_id']);
db_exec($q->prepare(true));
$msg = db_error();