当前位置: 首页>>代码示例>>PHP>>正文


PHP DBQuery::prepareInsert方法代码示例

本文整理汇总了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();
}
开发者ID:hoodoogurus,项目名称:dotprojecteap,代码行数:8,代码来源:upgrade_contacts_company.php

示例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();
 }
开发者ID:hoodoogurus,项目名称:dotprojecteap,代码行数:12,代码来源:test_eap.php

示例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();
开发者ID:srinivasulurao,项目名称:jonel,代码行数:31,代码来源:upgrade_contacts.php


注:本文中的DBQuery::prepareInsert方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。