本文整理汇总了PHP中vam_db_query函数的典型用法代码示例。如果您正苦于以下问题:PHP vam_db_query函数的具体用法?PHP vam_db_query怎么用?PHP vam_db_query使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vam_db_query函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: do_remove
/**
* Remove all info about requirements of this CIP
*/
function do_remove()
{
foreach ($this->req as $id => $require) {
$query = 'delete from ' . TABLE_CIP_DEPEND . ' where cip_ident = "' . $this->cip->getIdent() . '" and cip_ident_req= "' . $require . '" and cip_req_type=1';
vam_db_query($query);
}
}
示例2: splitPageResults
function splitPageResults(&$current_page_number, $max_rows_per_page, &$sql_query, &$query_num_rows)
{
if (empty($current_page_number)) {
$current_page_number = 1;
}
$pos_to = strlen($sql_query);
$pos_from = strpos($sql_query, ' from', 0);
$pos_group_by = strpos($sql_query, ' group by', $pos_from);
if ($pos_group_by < $pos_to && $pos_group_by != false) {
$pos_to = $pos_group_by;
}
$pos_having = strpos($sql_query, ' having', $pos_from);
if ($pos_having < $pos_to && $pos_having != false) {
$pos_to = $pos_having;
}
$pos_order_by = strpos($sql_query, ' order by', $pos_from);
if ($pos_order_by < $pos_to && $pos_order_by != false) {
$pos_to = $pos_order_by;
}
$reviews_count_query = vam_db_query("select count(*) as total " . substr($sql_query, $pos_from, $pos_to - $pos_from));
$reviews_count = vam_db_fetch_array($reviews_count_query);
$query_num_rows = $reviews_count['total'];
$num_pages = ceil($query_num_rows / $max_rows_per_page);
if ($current_page_number > $num_pages) {
$current_page_number = $num_pages;
}
$offset = $max_rows_per_page * ($current_page_number - 1);
if ($offset < 0) {
$offset = 0;
}
$sql_query .= " limit " . $offset . ", " . $max_rows_per_page;
}
示例3: updateBill
function updateBill($login, $password, $txn, $status)
{
//обработка возможных ошибок авторизации
if ($login != MODULE_PAYMENT_QIWI_ID) {
return 150;
}
if (!empty($password) && $password != strtoupper(md5($txn . strtoupper(md5(MODULE_PAYMENT_QIWI_SECRET_KEY))))) {
return 150;
}
// получаем номер заказа
$transaction = intval($txn);
// проверяем, есть ли такой заказ в базе
$order_query = vam_db_query("select count(*) as total from " . TABLE_ORDERS . " where orders_id = '" . (int) $transaction . "'");
$order_exists = vam_db_fetch_array($order_query);
if ($order_exists['total'] <= 0) {
return 210;
}
// меняем статус заказа при условии оплаты счёта
if ($status == 60) {
$sql_data_array = array('orders_status' => MODULE_PAYMENT_QIWI_ORDER_STATUS_ID);
vam_db_perform('orders', $sql_data_array, 'update', "orders_id='" . $transaction . "'");
$sql_data_arrax = array('orders_id' => $transaction, 'orders_status_id' => MODULE_PAYMENT_QIWI_ORDER_STATUS_ID, 'date_added' => 'now()', 'customer_notified' => '0', 'comments' => 'QIWI accepted this order payment');
vam_db_perform('orders_status_history', $sql_data_arrax);
// Отправляем письмо клиенту и админу о смене статуса заказа
require_once DIR_WS_CLASSES . 'order.php';
$order = new order($transaction);
$vamTemplate = new vamTemplate();
// assign language to template for caching
$vamTemplate->assign('language', $_SESSION['language']);
$vamTemplate->caching = false;
$vamTemplate->assign('tpl_path', 'templates/' . CURRENT_TEMPLATE . '/');
$vamTemplate->assign('logo_path', HTTP_SERVER . DIR_WS_CATALOG . 'templates/' . CURRENT_TEMPLATE . '/img/');
$vamTemplate->assign('NAME', $order->customer['firstname'] . ' ' . $order->customer['lastname']);
$vamTemplate->assign('ORDER_NR', $transaction);
$vamTemplate->assign('ORDER_LINK', vam_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $transaction, 'SSL'));
$vamTemplate->assign('ORDER_DATE', vam_date_long($order->info['date_purchased']));
$lang_query = vam_db_query("select languages_id from " . TABLE_LANGUAGES . " where directory = '" . $_SESSION['language'] . "'");
$lang = vam_db_fetch_array($lang_query);
$lang = $lang['languages_id'];
if (!isset($lang)) {
$lang = $_SESSION['languages_id'];
}
$orders_status_array = array();
$orders_status_query = vam_db_query("select orders_status_id, orders_status_name from " . TABLE_ORDERS_STATUS . " where language_id = '" . $lang . "'");
while ($orders_status = vam_db_fetch_array($orders_status_query)) {
$orders_statuses[] = array('id' => $orders_status['orders_status_id'], 'text' => $orders_status['orders_status_name']);
$orders_status_array[$orders_status['orders_status_id']] = $orders_status['orders_status_name'];
}
$vamTemplate->assign('ORDER_STATUS', $orders_status_array[MODULE_PAYMENT_QIWI_ORDER_STATUS_ID]);
$html_mail = $vamTemplate->fetch(CURRENT_TEMPLATE . '/admin/mail/' . $_SESSION['language'] . '/change_order_mail.html');
$txt_mail = $vamTemplate->fetch(CURRENT_TEMPLATE . '/admin/mail/' . $_SESSION['language'] . '/change_order_mail.txt');
include_once DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/payment/qiwi.php';
// create subject
$order_subject = str_replace('{$nr}', $transaction, MODULE_PAYMENT_QIWI_EMAIL_SUBJECT);
// send mail to admin
vam_php_mail(EMAIL_BILLING_ADDRESS, EMAIL_BILLING_NAME, EMAIL_BILLING_ADDRESS, STORE_NAME, EMAIL_BILLING_FORWARDING_STRING, $order->customer['email_address'], $order->customer['firstname'], '', '', $order_subject, $html_mail, $txt_mail);
// send mail to customer
vam_php_mail(EMAIL_BILLING_ADDRESS, EMAIL_BILLING_NAME, $order->customer['email_address'], $order->customer['firstname'] . ' ' . $order->customer['lastname'], '', EMAIL_BILLING_REPLY_ADDRESS, EMAIL_BILLING_REPLY_ADDRESS_NAME, '', '', $order_subject, $html_mail, $txt_mail);
}
}
示例4: vam_get_download
function vam_get_download($content_id)
{
$content_query = vam_db_query("SELECT\n\t\t\t\t\tcontent_file,\n\t\t\t\t\tcontent_read\n\t\t\t\t\tFROM " . TABLE_PRODUCTS_CONTENT . "\n\t\t\t\t\tWHERE content_id='" . $content_id . "'");
$content_data = vam_db_fetch_array($content_query);
// update file counter
vam_db_query("UPDATE \n\t\t\t" . TABLE_PRODUCTS_CONTENT . " \n\t\t\tSET content_read='" . ($content_data['content_read'] + 1) . "'\n\t\t\tWHERE content_id='" . $content_id . "'");
// original filename
$filename = DIR_FS_CATALOG . 'media/products/' . $content_data['content_file'];
$backup_filename = DIR_FS_CATALOG . 'media/products/backup/' . $content_data['content_file'];
// create md5 hash id from original file
$orign_hash_id = md5_file($filename);
clearstatcache();
// create new filename with timestamp
$timestamp = str_replace('.', '', microtime());
$timestamp = str_replace(' ', '', $timestamp);
$new_filename = DIR_FS_CATALOG . 'media/products/' . $timestamp . strstr($content_data['content_file'], '.');
// rename file
rename($filename, $new_filename);
if (file_exists($new_filename)) {
header("Content-type: application/force-download");
header("Content-Disposition: attachment; filename=" . $new_filename);
@readfile($new_filename);
// rename file to original name
rename($new_filename, $filename);
$new_hash_id = md5_file($filename);
clearstatcache();
// check hash id of file again, if not same, get backup!
if ($new_hash_id != $orign_hash_id) {
copy($backup_filename, $filename);
}
}
}
示例5: vam_get_tax_title_class_id
function vam_get_tax_title_class_id($tax_class_title)
{
$classes_query = vam_db_query("select tax_class_id from " . TABLE_TAX_CLASS . " WHERE tax_class_title = '" . $tax_class_title . "'");
$tax_class_array = vam_db_fetch_array($classes_query);
$tax_class_id = $tax_class_array['tax_class_id'];
return $tax_class_id;
}
示例6: vam_display_banner
function vam_display_banner($action, $identifier)
{
if ($action == 'dynamic') {
$banners_query = vam_db_query("select count(*) as count from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . $identifier . "'");
$banners = vam_db_fetch_array($banners_query);
if ($banners['count'] > 0) {
$banner = vam_random_select("select banners_id, banners_title, banners_image, banners_html_text from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . $identifier . "'");
} else {
return '<b>VaM Shop ERROR! (vam_display_banner(' . $action . ', ' . $identifier . ') -> No banners with group \'' . $identifier . '\' found!</b>';
}
} elseif ($action == 'static') {
if (is_array($identifier)) {
$banner = $identifier;
} else {
$banner_query = vam_db_query("select banners_id, banners_title, banners_image, banners_html_text from " . TABLE_BANNERS . " where status = '1' and banners_id = '" . $identifier . "'");
if (vam_db_num_rows($banner_query)) {
$banner = vam_db_fetch_array($banner_query);
} else {
return '<b>VaM Shop ERROR! (vam_display_banner(' . $action . ', ' . $identifier . ') -> Banner with ID \'' . $identifier . '\' not found, or status inactive</b>';
}
}
} else {
return '<b>VaM Shop ERROR! (vam_display_banner(' . $action . ', ' . $identifier . ') -> Unknown $action parameter value - it must be either \'dynamic\' or \'static\'</b>';
}
if (vam_not_null($banner['banners_html_text'])) {
$banner_string = $banner['banners_html_text'];
} else {
$banner_string = '<a href="' . vam_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banner['banners_id']) . '" onclick="window.open(this.href); return false;">' . vam_image(DIR_WS_IMAGES . 'banner/' . $banner['banners_image'], $banner['banners_title']) . '</a>';
}
vam_update_banner_display_count($banner['banners_id']);
return $banner_string;
}
示例7: vam_get_products_stock
function vam_get_products_stock($products_id)
{
$products_id = vam_get_prid($products_id);
$stock_query = vam_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . $products_id . "'");
$stock_values = vam_db_fetch_array($stock_query);
return $stock_values['products_quantity'];
}
示例8: vam_address_label
function vam_address_label($customers_id, $address_id = 1, $html = false, $boln = '', $eoln = "\n")
{
$address_query = vam_db_query("select entry_firstname as firstname, entry_secondname as secondname, entry_lastname as lastname, entry_company as company, entry_street_address as street_address, entry_suburb as suburb, entry_city as city, entry_postcode as postcode, entry_state as state, entry_zone_id as zone_id, entry_country_id as country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . $customers_id . "' and address_book_id = '" . $address_id . "'");
$address = vam_db_fetch_array($address_query);
$format_id = vam_get_address_format_id($address['country_id']);
return vam_address_format($format_id, $address, $html, $boln, $eoln);
}
示例9: affiliate_insert
function affiliate_insert($sql_data_array, $affiliate_parent = 0)
{
// LOCK TABLES
@mysql_query("LOCK TABLES " . TABLE_AFFILIATE . " WRITE");
if ($affiliate_parent > 0) {
$affiliate_root_query = vam_db_query("select affiliate_root, affiliate_rgt, affiliate_lft from " . TABLE_AFFILIATE . " where affiliate_id = '" . $affiliate_parent . "' ");
// Check if we have a parent affiliate
if ($affiliate_root_array = vam_db_fetch_array($affiliate_root_query)) {
vam_db_query("update " . TABLE_AFFILIATE . " SET affiliate_lft = affiliate_lft + 2 WHERE affiliate_root = '" . $affiliate_root_array['affiliate_root'] . "' and affiliate_lft > " . $affiliate_root_array['affiliate_rgt'] . " AND affiliate_rgt >= " . $affiliate_root_array['affiliate_rgt'] . " ");
vam_db_query("update " . TABLE_AFFILIATE . " SET affiliate_rgt = affiliate_rgt + 2 WHERE affiliate_root = '" . $affiliate_root_array['affiliate_root'] . "' and affiliate_rgt >= " . $affiliate_root_array['affiliate_rgt'] . " ");
$sql_data_array['affiliate_root'] = $affiliate_root_array['affiliate_root'];
$sql_data_array['affiliate_lft'] = $affiliate_root_array['affiliate_rgt'];
$sql_data_array['affiliate_rgt'] = $affiliate_root_array['affiliate_rgt'] + 1;
vam_db_perform(TABLE_AFFILIATE, $sql_data_array);
$affiliate_id = vam_db_insert_id();
}
// no parent -> new root
} else {
$sql_data_array['affiliate_lft'] = '1';
$sql_data_array['affiliate_rgt'] = '2';
vam_db_perform(TABLE_AFFILIATE, $sql_data_array);
$affiliate_id = vam_db_insert_id();
vam_db_query("update " . TABLE_AFFILIATE . " set affiliate_root = '" . $affiliate_id . "' where affiliate_id = '" . $affiliate_id . "' ");
}
// UNLOCK TABLES
@mysql_query("UNLOCK TABLES");
return $affiliate_id;
}
示例10: vam_oe_customer_infos
function vam_oe_customer_infos($customers_id)
{
$customer_query = vam_db_query("select a.entry_country_id, a.entry_zone_id from " . TABLE_CUSTOMERS . " c, " . TABLE_ADDRESS_BOOK . " a where c.customers_id = '" . $customers_id . "' and c.customers_id = a.customers_id and c.customers_default_address_id = a.address_book_id");
$customer = vam_db_fetch_array($customer_query);
$customer_info_array = array('country_id' => $customer['entry_country_id'], 'zone_id' => $customer['entry_zone_id']);
return $customer_info_array;
}
示例11: vam_get_customers_country
function vam_get_customers_country($customers_id)
{
$customers_query = vam_db_query("select customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_id = '" . $customers_id . "'");
$customers = vam_db_fetch_array($customers_query);
$address_book_query = vam_db_query("select entry_country_id from " . TABLE_ADDRESS_BOOK . " where address_book_id = '" . $customers['customers_default_address_id'] . "'");
$address_book = vam_db_fetch_array($address_book_query);
return $address_book['entry_country_id'];
}
示例12: file_changers
function file_changers($file_path)
{
$result = vam_db_query("\n SELECT content_md5, modification_date, contrib\n FROM " . TABLE_CIP_FILE_INTEGRITY . "\n WHERE path_md5='" . md5($file_path) . "'\n ORDER BY modification_date");
while ($file_changer = vam_db_fetch_array($result)) {
$array[] = array('path_md5' => $file_changer['path_md5'], 'content_md5' => $file_changer['content_md5'], 'modification_date' => $file_changer['modification_date'], 'contrib' => $file_changer['contrib']);
}
return $array;
}
示例13: currencies
function currencies()
{
$this->currencies = array();
$currencies_query = vam_db_query("select code, title, symbol_left, symbol_right, decimal_point, thousands_point, decimal_places, value from " . TABLE_CURRENCIES);
while ($currencies = vam_db_fetch_array($currencies_query)) {
$this->currencies[$currencies['code']] = array('title' => $currencies['title'], 'symbol_left' => $currencies['symbol_left'], 'symbol_right' => $currencies['symbol_right'], 'decimal_point' => $currencies['decimal_point'], 'thousands_point' => $currencies['thousands_point'], 'decimal_places' => $currencies['decimal_places'], 'value' => $currencies['value']);
}
}
示例14: get_price_range
function get_price_range($current_category)
{
$sql = "SELECT MAX(p.products_price) max_price, MIN(p.products_price) min_price\n FROM " . TABLE_PRODUCTS . " p \n INNER JOIN " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c ON p2c.products_id = p.products_id AND p2c.categories_id = " . $current_category . "\n WHERE p.products_status = '1'";
$res = vam_db_query($sql);
$price_limit = vam_db_fetch_array($res);
$result = "<script type='text/javascript'>\n\t\tvar min_price = " . $price_limit['min_price'] . ";\n\t\tvar max_price = " . $price_limit['max_price'] . ";\n </script>";
return $result;
}
示例15: vam_expire_specials
function vam_expire_specials()
{
$specials_query = vam_db_query("select specials_id from " . TABLE_SPECIALS . " where status = '1' and now() >= expires_date and expires_date > 0");
if (vam_db_num_rows($specials_query)) {
while ($specials = vam_db_fetch_array($specials_query)) {
vam_set_specials_status($specials['specials_id'], '0');
}
}
}