本文整理汇总了PHP中db_get_array函数的典型用法代码示例。如果您正苦于以下问题:PHP db_get_array函数的具体用法?PHP db_get_array怎么用?PHP db_get_array使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db_get_array函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updatePrices
public function updatePrices()
{
if ($this->updateType == 'excel') {
$lastRow = $this->excel->getActiveSheet()->getHighestRow();
for ($row = 2; $row <= $lastRow; $row++) {
$itemId = $this->excel->getActiveSheet()->getCell('A' . $row)->getValue();
$finalPrice = 0;
$qty = 0;
foreach ($this->config['vendors'] as $vendor) {
$price = $this->excel->getActiveSheet()->getCell($vendor["master-file-price-column"] . $row)->getValue();
if ($finalPrice < $price) {
$finalPrice = $price;
}
$qty += $this->excel->getActiveSheet()->getCell($vendor["master-file-qty-column"] . $row)->getValue();
}
db_query("UPDATE ?:products, vendor_items SET temp_price= ?i * (vendor_items.interest/100 + 1), temp_qty = ?i WHERE product_code= ?s AND vendor_items.item_id= '" . $itemId . "'", $finalPrice, $qty, $itemId);
}
} elseif ($this->updateType == 'db') {
foreach ($this->config['vendors'] as $vendor) {
$id_columns[] = $vendor['master-file-item-column-name'];
$price_columns[] = $vendor['master-file-price-column-name'];
$qty_columns[] = $vendor['master-file-qty-column-name'];
}
db_get_array("UPDATE cscart_products, vendor_prices, vendor_items SET temp_price=GREATEST(0, " . implode(",", $price_columns) . ") * (vendor_items.interest/100 + 1), temp_qty=" . implode("+", $qty_columns) . " WHERE product_code= vendor_prices.item_id AND vendor_items.item_id=product_code");
}
}
示例2: fn_get_seo_rules
function fn_get_seo_rules($params = array(), $items_per_page = 0, $lang_code = DESCR_SL)
{
$lang_code = fn_get_corrected_seo_lang_code($lang_code);
$global_total = db_get_fields("SELECT dispatch FROM ?:seo_names WHERE object_id = '0' AND type = 's' GROUP BY dispatch");
$local_total = db_get_fields("SELECT dispatch FROM ?:seo_names WHERE object_id = '0' AND type = 's' AND lang_code = ?s", $lang_code);
if ($diff = array_diff($global_total, $local_total)) {
foreach ($diff as $disp) {
fn_create_seo_name(0, 's', str_replace('.', '-', $disp), 0, $disp, DESCR_SL);
}
}
// Init filter
$params = fn_init_view('seo_rules', $params);
// Set default values to input params
$params['page'] = empty($params['page']) ? 1 : $params['page'];
// default page is 1
$condition = '';
if (isset($params['name']) && fn_string_no_empty($params['name'])) {
$condition .= db_quote(" AND name LIKE ?l", "%" . trim($params['name']) . "%");
}
if (isset($params['controller']) && fn_string_no_empty($params['controller'])) {
$condition .= db_quote(" AND dispatch LIKE ?l", "%" . trim($params['controller']) . "%");
}
$limit = '';
if (!empty($items_per_page)) {
$total = db_get_field("SELECT COUNT(*) FROM ?:seo_names WHERE object_id = '0' AND type = 's' AND lang_code = ?s ?p", $lang_code, $condition);
$limit = fn_paginate($params['page'], $total, $items_per_page);
}
$seo_data = db_get_array("SELECT name, dispatch FROM ?:seo_names WHERE object_id = '0' AND type = 's' AND lang_code = ?s ?p ORDER BY dispatch {$limit}", $lang_code, $condition);
return array($seo_data, $params);
}
示例3: fn_settings_actions_addons_access_restrictions_admin_reverse_ip_access
/**
* Reverse IP filter
*/
function fn_settings_actions_addons_access_restrictions_admin_reverse_ip_access(&$new_value, $old_value)
{
$ip = fn_get_ip(true);
if ($new_value == 'Y') {
$ip_data = db_get_row("SELECT item_id, status FROM ?:access_restriction WHERE ip_from = ?i AND ip_to = ?i AND type IN ('aas', 'aab', 'aar')", $ip['host'], $ip['host']);
if (empty($ip_data) || empty($ip_data['item_id'])) {
// Add IP
$restrict_ip = array('ip_from' => $ip['host'], 'ip_to' => $ip['host'], 'type' => 'aas', 'timestamp' => TIME, 'expires' => '0', 'status' => 'A');
$__data = array();
$__data['item_id'] = db_query("REPLACE INTO ?:access_restriction ?e", $restrict_ip);
$__data['type'] = 'aas';
foreach (fn_get_translation_languages() as $__data['lang_code'] => $_v) {
$__data['reason'] = __('store_admin', '', $__data['lang_code']);
db_query("REPLACE INTO ?:access_restriction_reason_descriptions ?e", $__data);
}
fn_set_notification('W', __('warning'), __('your_ip_added', array('[ip]' => long2ip($ip['host']))));
} elseif (empty($ip_data['status']) || $ip_data['status'] != 'A') {
// Change IP status to available
db_query("UPDATE ?:access_restriction SET ?u WHERE item_id = ?i", array('status' => 'A'), $ip_data['item_id']);
fn_set_notification('W', __('warning'), __('your_ip_enabled', array('[ip]' => long2ip($ip['host']))));
}
} else {
// Delete IP
$ips_data = db_get_array("SELECT item_id, type FROM ?:access_restriction WHERE ip_from <= ?i AND ip_to >= ?i AND type IN ('aas', 'aab', 'aar')", $ip['host'], $ip['host']);
if (!empty($ips_data)) {
foreach ($ips_data as $ip_data) {
db_query("DELETE FROM ?:access_restriction WHERE item_id = ?i", $ip_data['item_id']);
db_query("DELETE FROM ?:access_restriction_reason_descriptions WHERE item_id = ?i AND type = ?s", $ip_data['item_id'], $ip_data['type']);
}
fn_set_notification('W', __('warning'), __('your_ip_removed', array('[ip]' => long2ip($ip['host']))));
}
}
return true;
}
示例4: import
public function import($db_already_cloned)
{
General::setProgressTitle(__CLASS__);
if (!$db_already_cloned) {
if (!General::cloneImportedDB($this->store_data)) {
return false;
}
} else {
General::setEmptyProgressBar(__('importing_data'));
General::setEmptyProgressBar(__('importing_data'));
}
$main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
General::backupSettings();
if (is_file($main_sql)) {
//Process main sql
if (!db_import_sql_file($main_sql)) {
return false;
}
}
//Find all quick menu linked to the template_editor and change it to file_editor
$quick_menus = db_get_array("SELECT * FROM ?:quick_menu WHERE url LIKE '%template_editor%'");
foreach ($quick_menus as $quick_menu) {
$quick_menu['url'] = str_replace('template_editor', 'file_editor', $quick_menu['url']);
db_query("REPLACE INTO ?:quick_menu ?e", $quick_menu);
}
General::setEmptyProgressBar();
General::setEmptyProgressBar();
General::setEmptyProgressBar();
General::setEmptyProgressBar();
return true;
}
示例5: fn_get_seo_rules
function fn_get_seo_rules($params = array(), $items_per_page = 0, $lang_code = DESCR_SL)
{
$condition = fn_get_seo_company_condition('?:seo_names.company_id');
$lang_code = fn_get_corrected_seo_lang_code($lang_code);
$global_total = db_get_fields("SELECT dispatch FROM ?:seo_names WHERE object_id = '0' AND type = 's' ?p GROUP BY dispatch", $condition);
$local_total = db_get_fields("SELECT dispatch FROM ?:seo_names WHERE object_id = '0' AND type = 's' AND lang_code = ?s ?p", $lang_code, $condition);
if ($diff = array_diff($global_total, $local_total)) {
foreach ($diff as $disp) {
fn_create_seo_name(0, 's', str_replace('.', '-', $disp), 0, $disp, '', DESCR_SL);
}
}
// Init filter
$params = LastView::instance()->update('seo_rules', $params);
// Set default values to input params
$default_params = array('page' => 1, 'items_per_page' => $items_per_page);
$params = array_merge($default_params, $params);
if (isset($params['name']) && fn_string_not_empty($params['name'])) {
$condition .= db_quote(" AND name LIKE ?l", "%" . trim($params['name']) . "%");
}
if (isset($params['rule_params']) && fn_string_not_empty($params['rule_params'])) {
$condition .= db_quote(" AND dispatch LIKE ?l", "%" . trim($params['rule_params']) . "%");
}
$limit = '';
if (!empty($params['items_per_page'])) {
$params['total_items'] = db_get_field("SELECT COUNT(*) FROM ?:seo_names WHERE object_id = '0' AND type = 's' AND lang_code = ?s ?p", $lang_code, $condition);
$limit = db_paginate($params['page'], $params['items_per_page'], $params['total_items']);
}
$seo_data = db_get_array("SELECT name, dispatch FROM ?:seo_names WHERE object_id = '0' AND type = 's' AND lang_code = ?s ?p ORDER BY dispatch {$limit}", $lang_code, $condition);
return array($seo_data, $params);
}
示例6: fn_get_required_products_linked_to_options_by_product_id
function fn_get_required_products_linked_to_options_by_product_id($product_id)
{
$finalResults = array();
$fieldsOptionsVariantsLinksToProducts = " d.product_id AS linked_prodict_id";
$conditionOptionsVariantsLinksToProducts = db_quote(' (?:product_options.product_id = ?i OR (?:product_options.product_id=0 AND n.product_id = ?i))', $product_id, $product_id);
$joinOptionsVariantsLinksToProducts = db_quote(' LEFT JOIN ?:product_global_option_links n ON ?:product_options.option_id = n.option_id ');
$joinOptionsVariantsLinksToProducts .= db_quote(' JOIN ?:product_option_variants c ON ?:product_options.option_id = c.option_id');
$joinOptionsVariantsLinksToProducts .= db_quote(' JOIN ?:product_option_variants_link d ON c.variant_id = d.option_variant_id');
$optsVariantsLinksToProducts = db_get_array("SELECT " . $fieldsOptionsVariantsLinksToProducts . " FROM ?:product_options " . $joinOptionsVariantsLinksToProducts . " WHERE " . $conditionOptionsVariantsLinksToProducts . " GROUP BY c.variant_id, ?:product_options.option_id" . " ORDER BY ?:product_options.position, c.position");
}
示例7: fn_get_store_locations
function fn_get_store_locations($params, $items_per_page = 0, $lang_code = CART_LANGUAGE)
{
$default_params = array('page' => 1, 'q' => '', 'match' => 'any');
$params = array_merge($default_params, $params);
$fields = array('?:store_locations.*', '?:store_location_descriptions.*', '?:country_descriptions.country as country_title');
$join = db_quote(" LEFT JOIN ?:store_location_descriptions ON ?:store_locations.store_location_id = ?:store_location_descriptions.store_location_id AND ?:store_location_descriptions.lang_code = ?s", $lang_code);
$join .= db_quote(" LEFT JOIN ?:country_descriptions ON ?:store_locations.country = ?:country_descriptions.code AND ?:country_descriptions.lang_code = ?s", $lang_code);
$condition = 1;
if (AREA == 'C') {
$condition .= " AND status = 'A'";
}
// Search string condition for SQL query
if (!empty($params['q'])) {
if ($params['match'] == 'any') {
$pieces = explode(' ', $params['q']);
$search_type = ' OR ';
} elseif ($params['match'] == 'all') {
$pieces = explode(' ', $params['q']);
$search_type = ' AND ';
} else {
$pieces = array($params['q']);
$search_type = '';
}
$_condition = array();
foreach ($pieces as $piece) {
$tmp = db_quote("?:store_location_descriptions.name LIKE ?l", "%{$piece}%");
// check search words
$tmp .= db_quote(" OR ?:store_location_descriptions.description LIKE ?l", "%{$piece}%");
$tmp .= db_quote(" OR ?:store_location_descriptions.city LIKE ?l", "%{$piece}%");
$tmp .= db_quote(" OR ?:country_descriptions.country LIKE ?l", "%{$piece}%");
$_condition[] = '(' . $tmp . ')';
}
$_cond = implode($search_type, $_condition);
if (!empty($_condition)) {
$condition .= ' AND (' . $_cond . ') ';
}
unset($_condition);
}
$condition .= AREA == 'C' && defined('CART_LOCALIZATION') ? fn_get_localizations_condition('?:store_locations.localization') : '';
$sorting = "?:store_locations.position, ?:store_location_descriptions.name";
$limit = '';
$total = 0;
if (!empty($items_per_page)) {
$total = db_get_field("SELECT COUNT(?:store_locations.store_location_id) FROM ?:store_locations ?p WHERE ?p", $join, $condition);
$limit = fn_paginate($params['page'], $total, $items_per_page);
}
$data = db_get_array('SELECT ?p FROM ?:store_locations ?p WHERE ?p GROUP BY ?:store_locations.store_location_id ORDER BY ?p ?p', implode(', ', $fields), $join, $condition, $sorting, $limit);
if (!$total) {
$total = count($data);
}
return array($data, $params, $total);
}
示例8: fn_exim_get_usergroups
function fn_exim_get_usergroups($user_id)
{
$pair_delimiter = ':';
$set_delimiter = '; ';
$result = array();
$usergroups = db_get_array("SELECT usergroup_id, status FROM ?:usergroup_links WHERE user_id = ?i", $user_id);
if (!empty($usergroups)) {
foreach ($usergroups as $ug) {
$result[] = $ug['usergroup_id'] . $pair_delimiter . $ug['status'];
}
}
return !empty($result) ? implode($set_delimiter, $result) : '';
}
示例9: fn_get_features_list
function fn_get_features_list()
{
$features_list = array('-');
$_fl = db_get_array("SELECT a.feature_id, b.description FROM ?:product_features as a LEFT JOIN ?:product_features_descriptions as b ON a.feature_id=b.feature_id WHERE b.lang_code = ?s AND (a.feature_type = 'S' OR a.feature_type = 'E') ORDER BY b.description", CART_LANGUAGE);
if (!empty($_fl)) {
foreach ($_fl as $v) {
if (!empty($v['description'])) {
$features_list[$v['feature_id']] = $v['description'];
}
}
}
return $features_list;
}
示例10: fn_gift_registry_get_userlog
function fn_gift_registry_get_userlog($params, $items_per_page = 0)
{
// Set default values to input params
$default_params = array('page' => 1, 'items_per_page' => $items_per_page);
$params = array_merge($default_params, $params);
$sortings = array('timestamp' => 'timestamp', 'amount' => 'amount');
$sorting = db_sort($params, $sortings, 'timestamp', 'desc');
$limit = '';
if (!empty($params['items_per_page'])) {
$params['total_items'] = db_get_field("SELECT COUNT(*) FROM ?:reward_point_changes WHERE user_id = ?i", $params['user_id']);
$limit = db_paginate($params['page'], $params['items_per_page'], $params['total_items']);
}
$userlog = db_get_array("SELECT change_id, action, timestamp, amount, reason FROM ?:reward_point_changes WHERE user_id = ?i {$sorting} {$limit}", $params['user_id']);
return array($userlog, $params);
}
示例11: sendUaStat
public static function sendUaStat()
{
$access_id = TwigmoConnector::getAccessID('A');
if (!$access_id) {
return;
}
$query = db_quote('FROM ?:twigmo_ua_stat WHERE month<?s LIMIT ?i', date('Y-m-1'), 100);
$needToSend = db_get_array('SELECT *, ?s as access_id ' . $query, $access_id);
if (!count($needToSend)) {
return;
}
$responce = Http::post(TWG_UA_RULES_STAT, array('stat' => serialize($needToSend)));
if ($responce == 'ok') {
db_query('DELETE ' . $query);
}
}
示例12: fn_staff_block_manager_get_staff_members_for_block
/**
* Returns an array of staff members with image_pairs
*
* @return array $data
*/
function fn_staff_block_manager_get_staff_members_for_block($arg, $settings, $block)
{
$properties = $settings['properties'];
if (isset($properties['staff_sort_by_position']) && in_array($properties['staff_sort_by_position'], array('asc', 'desc'))) {
$order = " ORDER BY s.position {$properties['staff_sort_by_position']}";
}
$fields = "s.*, u.firstname as linked_firstname, u.lastname as linked_lastname, u.email as linked_email";
$join = db_quote(" LEFT JOIN ?:users as u ON s.linked_user_id = u.user_id");
$query = "SELECT " . $fields . " FROM ?:staff as s" . $join;
if (isset($order)) {
$query .= db_quote($order);
}
$data = db_get_array($query);
for ($i = 0; $i < count($data); $i++) {
$data[$i]['main_pair'] = fn_get_image_pairs($data[$i]['user_id'], 'staff', 'M', true, true, CART_LANGUAGE);
}
return $data;
}
示例13: fn_age_verification_update_parent_data
function fn_age_verification_update_parent_data($category_id, $age_verification, $age_limit)
{
$data = db_get_array("SELECT category_id, age_verification, age_limit, parent_age_verification, parent_age_limit FROM ?:categories WHERE parent_id = ?i", $category_id);
db_query("UPDATE ?:categories SET parent_age_verification = ?s, parent_age_limit = ?i WHERE parent_id = ?i", $age_verification, $age_limit, $category_id);
foreach ($data as $key => $entry) {
$update = false;
if ($entry['age_verification'] == 'N' && $age_verification == 'Y') {
$update = true;
}
if ($entry['age_limit'] < $age_limit || $entry['age_verification'] == 'N' && $age_verification == 'N' && ($age_limit = 0)) {
$update = true;
}
if ($update) {
fn_age_verification_update_parent_data($entry['category_id'], $age_verification, $age_limit);
} elseif ($entry['age_verification'] == 'Y' && $entry['age_limit'] > $age_limit) {
fn_age_verification_update_parent_data($entry['category_id'], $entry['age_verification'], $entry['age_limit']);
}
}
}
示例14: fn_seo_settings_update
function fn_seo_settings_update($type, $option, $new_value, $redirect_only)
{
$i = 0;
$items_per_pass = 100;
$old_value = Registry::get('addons.seo.' . $option);
$company_condition = fn_get_seo_company_condition('?:seo_names.company_id', $type);
while ($update_data = db_get_array("SELECT * FROM ?:seo_names WHERE type = ?s ?p LIMIT {$i}, {$items_per_pass}", $type, $company_condition)) {
foreach ($update_data as $data) {
Registry::set('addons.seo.' . $option, $old_value);
$url = fn_generate_seo_url_from_schema(array('type' => $data['type'], 'object_id' => $data['object_id'], 'lang_code' => $data['lang_code']), false);
fn_seo_update_redirect(array('src' => $url, 'type' => $data['type'], 'object_id' => $data['object_id'], 'company_id' => $data['company_id'], 'lang_code' => $data['lang_code']), 0, false);
if (!$redirect_only) {
Registry::set('addons.seo.' . $option, $new_value);
fn_create_seo_name($data['object_id'], $data['type'], $data['name'], 0, '', $data['company_id'], $data['lang_code'], true);
}
}
$i += $items_per_pass;
}
}
示例15: fn_get_feedbacks
function fn_get_feedbacks($params, $items_per_page, $lang_code = CART_LANGUAGE)
{
$params = LastView::instance()->update('feedbacks', $params);
$default_params = array('page' => 1, 'items_per_page' => $items_per_page);
$params = array_merge($default_params, $params);
$fields = array("?:orders_feedback.feedback_id", "?:orders_feedback.statuses", "?:orders_feedback.subject", "?:orders_feedback.remind_in", "?:orders_feedback.status", "?:orders_feedback.lang_code");
$sortings = array('feedback_id' => "?:orders_feedback.feedback_id", 'subject' => "?:orders_feedback.subject", 'statuses' => "?:orders_feedback.statuses", 'remind_in' => "?:orders_feedback.remind_in");
$condition = $_condition = $join = $group = '';
/*conditions*/
$condition .= db_quote(' AND lang_code = ?s', $lang_code);
/*conditions*/
$sorting = db_sort($params, $sortings, 'feedback_id', 'desc');
$limit = '';
if (!empty($params['items_per_page'])) {
$params['total_items'] = db_get_field("SELECT COUNT(?:orders_feedback.feedback_id) FROM ?:orders_feedback {$join} WHERE 1 {$condition}");
$limit = db_paginate($params['page'], $params['items_per_page']);
}
$feedbacks = db_get_array('SELECT ' . implode(', ', $fields) . " FROM ?:orders_feedback {$join} WHERE 1 {$condition} {$group} {$sorting} {$limit}");
LastView::instance()->processResults('feedbacks', $feedbacks, $params);
return array($feedbacks, $params);
}