本文整理汇总了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();