本文整理汇总了PHP中w2p_Database_Query::updateArray方法的典型用法代码示例。如果您正苦于以下问题:PHP w2p_Database_Query::updateArray方法的具体用法?PHP w2p_Database_Query::updateArray怎么用?PHP w2p_Database_Query::updateArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类w2p_Database_Query
的用法示例。
在下文中一共展示了w2p_Database_Query::updateArray方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
//Try to find a matching company name in the system, if not them set contact_company to 0
$q = new w2p_Database_Query();
$q->addQuery('company_id');
$q->addTable('companies');
$q->addWhere('company_name LIKE \'' . mb_trim($pairs['contact_company']) . '\'');
$company_id = $q->loadResult();
$pairs['contact_company'] = $company_id ? $company_id : 0;
$q->clear();
//Try to find a matching department name in the system, if not them set contact_department to 0
$q->addQuery('dept_id');
$q->addTable('departments');
$q->addWhere('dept_name LIKE \'' . mb_trim($pairs['contact_department']) . '\'');
$dept_id = $q->loadResult();
$pairs['contact_department'] = $dept_id ? $dept_id : 0;
$q->clear();
$q->updateArray($sql_table, $pairs, 'contact_id');
$q->clear();
$s .= '<td><span style="color:#880000;">There is a duplicate record for ' . $pairs['contact_first_name'] . ' ' . $pairs['contact_last_name'] . ', the record has been updated.</span></td>';
} else {
//If the contact has no name, go to the next
if (!mb_trim($pairs['contact_first_name'] . ' ' . $pairs['contact_last_name'])) {
continue;
}
$s .= '<td>Adding ' . $pairs['contact_first_name'] . ' ' . $pairs['contact_last_name'] . '.</td>';
//Try to find a matching company name in the system, if not them set contact_company to 0
$q = new w2p_Database_Query();
$q->addQuery('company_id');
$q->addTable('companies');
$q->addWhere('company_name LIKE \'' . mb_trim($pairs['contact_company']) . '\'');
$company_id = $q->loadResult();
$pairs['contact_company'] = $company_id ? $company_id : 0;