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


PHP smn_db_query函数代码示例

本文整理汇总了PHP中smn_db_query函数的典型用法代码示例。如果您正苦于以下问题:PHP smn_db_query函数的具体用法?PHP smn_db_query怎么用?PHP smn_db_query使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了smn_db_query函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: smn_update_whos_online

function smn_update_whos_online()
{
    global $customer_id;
    if (smn_session_is_registered('customer_id')) {
        $wo_customer_id = $customer_id;
        $customer_query = smn_db_query("select customers_firstname, customers_lastname from " . TABLE_CUSTOMERS . " where customers_id = '" . (int) $customer_id . "'");
        $customer = smn_db_fetch_array($customer_query);
        $wo_full_name = $customer['customers_firstname'] . ' ' . $customer['customers_lastname'];
    } else {
        $wwo_full_name = 'Guest';
    }
    $wo_session_id = smn_session_id();
    $wo_ip_address = getenv('REMOTE_ADDR');
    $wo_last_page_url = getenv('REQUEST_URI');
    $current_time = time();
    $xx_mins_ago = $current_time - 900;
    // remove entries that have expired
    smn_db_query("delete from " . TABLE_WHOS_ONLINE . " where time_last_click < '" . $xx_mins_ago . "'");
    $stored_customer_query = smn_db_query("select count(*) as count from " . TABLE_WHOS_ONLINE . " where session_id = '" . smn_db_input($wo_session_id) . "'");
    $stored_customer = smn_db_fetch_array($stored_customer_query);
    if ($stored_customer['count'] > 0) {
        smn_db_query("update " . TABLE_WHOS_ONLINE . " set customer_id = '" . (int) $wo_customer_id . "', full_name = '" . smn_db_input($wo_full_name) . "', ip_address = '" . smn_db_input($wo_ip_address) . "', time_last_click = '" . smn_db_input($current_time) . "', last_page_url = '" . smn_db_input($wo_last_page_url) . "' where session_id = '" . smn_db_input($wo_session_id) . "'");
    } else {
        smn_db_query("insert into " . TABLE_WHOS_ONLINE . " (customer_id, full_name, session_id, ip_address, time_entry, time_last_click, last_page_url) values ('" . (int) $wo_customer_id . "', '" . smn_db_input($wo_full_name) . "', '" . smn_db_input($wo_session_id) . "', '" . smn_db_input($wo_ip_address) . "', '" . smn_db_input($current_time) . "', '" . smn_db_input($current_time) . "', '" . smn_db_input($wo_last_page_url) . "')");
    }
}
开发者ID:stanislauslive,项目名称:StanMarket,代码行数:26,代码来源:whos_online.php

示例2: affiliate_insert

function affiliate_insert($sql_data_array, $affiliate_parent = 0)
{
    // LOCK TABLES
    smn_db_query("LOCK TABLES " . TABLE_AFFILIATE . " WRITE");
    if ($affiliate_parent > 0) {
        $affiliate_root_query = smn_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 = smn_db_fetch_array($affiliate_root_query)) {
            smn_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'] . " ");
            smn_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;
            smn_db_perform(TABLE_AFFILIATE, $sql_data_array);
            $affiliate_id = smn_db_insert_id();
        }
        // no parent -> new root
    } else {
        $sql_data_array['affiliate_lft'] = '1';
        $sql_data_array['affiliate_rgt'] = '2';
        smn_db_perform(TABLE_AFFILIATE, $sql_data_array);
        $affiliate_id = smn_db_insert_id();
        smn_db_query("update " . TABLE_AFFILIATE . " set affiliate_root = '" . $affiliate_id . "' where affiliate_id = '" . $affiliate_id . "' ");
    }
    // UNLOCK TABLES
    smn_db_query("UNLOCK TABLES");
    return $affiliate_id;
}
开发者ID:stanislauslive,项目名称:StanMarket,代码行数:28,代码来源:affiliate_functions.php

示例3: smn_get_category_description

function smn_get_category_description($category_id, $language_id)
{
    global $store_id;
    $category_query = smn_db_query("select categories_description from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . $category_id . "' and language_id = '" . $language_id . "' and store_id = '" . $store_id . "'");
    $category = smn_db_fetch_array($category_query);
    return $category['categories_description'];
}
开发者ID:stanislauslive,项目名称:StanMarket,代码行数:7,代码来源:categories_description.php

示例4: smn_get_header_tag_products_desc

function smn_get_header_tag_products_desc($product_id)
{
    global $languages_id, $_GET;
    $product_header_tags = smn_db_query("select products_head_desc_tag from " . TABLE_PRODUCTS_DESCRIPTION . " where language_id = '" . (int) $languages_id . "' and products_id = '" . (int) $_GET['products_id'] . "'");
    $product_header_tags_values = smn_db_fetch_array($product_header_tags);
    return $product_header_tags_values['products_head_desc_tag'];
}
开发者ID:stanislauslive,项目名称:StanMarket,代码行数:7,代码来源:header_tags.php

示例5: splitPageResults

 function splitPageResults(&$current_page_number, $max_rows_per_page, &$sql_query, &$query_num_rows)
 {
     if (empty($current_page_number)) {
         $current_page_number = 1;
     }
     if (!isset($query_num_rows)) {
         $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 = smn_db_query("select count(*) as total " . substr($sql_query, $pos_from, $pos_to - $pos_from));
         $reviews_count = smn_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($max_rows_per_page * ($current_page_number - 1), 0);
     // systemsmanager begin - Dec 1, 2005 security patch
     //      $sql_query .= " limit " . $offset . ", " . $max_rows_per_page;
     $sql_query .= " limit " . max($offset, 0) . ", " . $max_rows_per_page;
     // systemsmanager end
 }
开发者ID:stanislauslive,项目名称:StanMarket,代码行数:34,代码来源:split_page_results.php

示例6: query

 function query($order_id)
 {
     global $store_id;
     $order_query = smn_db_query("select customers_name, customers_company, customers_street_address, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value, date_purchased, orders_status, last_modified from " . TABLE_ORDERS . " where store_id = '" . $store_id . "' and orders_id = '" . (int) $order_id . "'");
     $order = smn_db_fetch_array($order_query);
     $totals_query = smn_db_query("select title, text from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int) $order_id . "' order by sort_order");
     while ($totals = smn_db_fetch_array($totals_query)) {
         $this->totals[] = array('title' => $totals['title'], 'text' => $totals['text']);
     }
     $this->info = array('currency' => $order['currency'], 'currency_value' => $order['currency_value'], 'payment_method' => $order['payment_method'], 'cc_type' => $order['cc_type'], 'cc_owner' => $order['cc_owner'], 'cc_number' => $order['cc_number'], 'cc_expires' => $order['cc_expires'], 'date_purchased' => $order['date_purchased'], 'orders_status' => $order['orders_status'], 'last_modified' => $order['last_modified']);
     $this->customer = array('name' => $order['customers_name'], 'company' => $order['customers_company'], 'street_address' => $order['customers_street_address'], 'city' => $order['customers_city'], 'postcode' => $order['customers_postcode'], 'state' => $order['customers_state'], 'country' => $order['customers_country'], 'format_id' => $order['customers_address_format_id'], 'telephone' => $order['customers_telephone'], 'email_address' => $order['customers_email_address']);
     $this->delivery = array('name' => $order['delivery_name'], 'company' => $order['delivery_company'], 'street_address' => $order['delivery_street_address'], 'city' => $order['delivery_city'], 'postcode' => $order['delivery_postcode'], 'state' => $order['delivery_state'], 'country' => $order['delivery_country'], 'format_id' => $order['delivery_address_format_id']);
     $this->billing = array('name' => $order['billing_name'], 'company' => $order['billing_company'], 'street_address' => $order['billing_street_address'], 'city' => $order['billing_city'], 'postcode' => $order['billing_postcode'], 'state' => $order['billing_state'], 'country' => $order['billing_country'], 'format_id' => $order['billing_address_format_id']);
     $index = 0;
     $orders_products_query = smn_db_query("select orders_products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int) $order_id . "'");
     while ($orders_products = smn_db_fetch_array($orders_products_query)) {
         $this->products[$index] = array('qty' => $orders_products['products_quantity'], 'name' => $orders_products['products_name'], 'model' => $orders_products['products_model'], 'tax' => $orders_products['products_tax'], 'price' => $orders_products['products_price'], 'final_price' => $orders_products['final_price']);
         $subindex = 0;
         $attributes_query = smn_db_query("select products_options, products_options_values, options_values_price, price_prefix from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int) $order_id . "' and orders_products_id = '" . (int) $orders_products['orders_products_id'] . "'");
         if (smn_db_num_rows($attributes_query)) {
             while ($attributes = smn_db_fetch_array($attributes_query)) {
                 $this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'], 'value' => $attributes['products_options_values'], 'prefix' => $attributes['price_prefix'], 'price' => $attributes['options_values_price']);
                 $subindex++;
             }
         }
         $index++;
     }
 }
开发者ID:stanislauslive,项目名称:StanMarket,代码行数:28,代码来源:order.php

示例7: getConfigValue

function getConfigValue($gID, $cID)
{
    global $filter;
    $configuration_query = smn_db_query("select configuration_value, use_function from " . TABLE_CONFIGURATION . " where configuration_id = '" . $cID . "' and configuration_group_id = '" . (int) $gID . "'" . $filter . " order by sort_order");
    $configuration = smn_db_fetch_array($configuration_query);
    if (smn_not_null($configuration['use_function'])) {
        $use_function = $configuration['use_function'];
        if (ereg('->', $use_function)) {
            $class_method = explode('->', $use_function);
            if (!is_object(${$class_method[0]})) {
                include DIR_WS_CLASSES . $class_method[0] . '.php';
                ${$class_method[0]} = new $class_method[0]();
            }
            $cfgValue = smn_call_function($class_method[1], $configuration['configuration_value'], ${$class_method[0]});
        } else {
            $cfgValue = smn_call_function($use_function, $configuration['configuration_value']);
        }
    } else {
        $cfgValue = $configuration['configuration_value'];
    }
    if (empty($cfgValue) && !is_numeric($cfgValue)) {
        $cfgValue = '&nbsp;';
    }
    return $cfgValue;
}
开发者ID:stanislauslive,项目名称:StanMarket,代码行数:25,代码来源:configuration.php

示例8: currencies

 function currencies()
 {
     $this->currencies = array();
     $currencies_query = smn_db_query("select code, title, symbol_left, symbol_right, decimal_point, thousands_point, decimal_places, value from " . TABLE_CURRENCIES);
     while ($currencies = smn_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']);
     }
 }
开发者ID:stanislauslive,项目名称:StanMarket,代码行数:8,代码来源:currencies.php

示例9: smn_delete_store

function smn_delete_store($prefix)
{
    global $languages;
    if ($prefix != '') {
        $DB_tables = array(TABLE_ADMIN, TABLE_CATEGORIES, TABLE_CATEGORIES_DESCRIPTION, TABLE_CONFIGURATION, TABLE_LANGUAGES, TABLE_NEWSLETTERS, TABLE_ORDERS_TRACKING, TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD, TABLE_PRODUCTS_NOTIFICATIONS, TABLE_PRODUCTS_OPTIONS, TABLE_PRODUCTS_OPTIONS_VALUES, TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS, TABLE_REVIEWS, TABLE_REVIEWS_DESCRIPTION, TABLE_TAX_CLASS, TABLE_TAX_RATES, TABLE_GEO_ZONES, TABLE_ZONES_TO_GEO_ZONES, TABLE_ARTICLES, TABLE_WEB_SITE_CONTENT, TABLE_DYNAMIC_PAGE_INDEX, TABLE_SPECIALS, TABLE_STORE_MAIN, TABLE_STORE_COSTS, TABLE_STORE_TO_CATEGORIES, TABLE_STORE_DESCRIPTION, TABLE_STORE_REVIEWS, TABLE_MEMBER_ORDERS);
        //delete all DB table rows associated with the store....
        foreach ($DB_tables as $table_name) {
            smn_db_query("delete from " . $table_name . " WHERE store_id = '" . $prefix . "'");
        }
        //remove products from system
        $product_categories_query = smn_db_query("select products_id from " . TABLE_PRODUCTS . " where store_id = '" . (int) $prefix . "'");
        while ($product_categories = smn_db_fetch_array($product_categories_query)) {
            $product_id = (int) $product_categories['products_id'];
            smn_db_query("delete from " . TABLE_SPECIALS . " where products_id = '" . $product_id . "' and store_id = '" . (int) $prefix . "'");
            smn_db_query("delete from " . TABLE_PRODUCTS . " where products_id = '" . $product_id . "' and store_id = '" . (int) $prefix . "'");
            smn_db_query("delete from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . $product_id . "' and store_id = '" . (int) $prefix . "'");
            smn_db_query("delete from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . $product_id . "'");
            smn_db_query("delete from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . $product_id . "' and store_id = '" . (int) $prefix . "'");
            smn_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where products_id = '" . $product_id . "' and store_id = '" . (int) $prefix . "'");
            smn_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where products_id = '" . $product_id . "' and store_id = '" . (int) $prefix . "'");
            $product_reviews_query = smn_db_query("select reviews_id from " . TABLE_REVIEWS . " where products_id = '" . $product_id . "'");
            while ($product_reviews = smn_db_fetch_array($product_reviews_query)) {
                smn_db_query("delete from " . TABLE_REVIEWS_DESCRIPTION . " where reviews_id = '" . $product_reviews['reviews_id'] . "' and store_id = '" . (int) $prefix . "'");
            }
            smn_db_query("delete from " . TABLE_REVIEWS . " where products_id = '" . $product_id . "' and store_id = '" . (int) $prefix . "'");
            if (USE_CACHE == 'true') {
                smn_reset_cache_block('categories');
                smn_reset_cache_block('also_purchased');
            }
        }
        //remove orders from system
        $store_orders_query = smn_db_query("select orders_id from " . TABLE_ORDERS . " where store_id = '" . (int) $prefix . "'");
        while ($store_orders = smn_db_fetch_array($store_orders_query)) {
            smn_db_query("delete from " . TABLE_ORDERS_TRACKING . " WHERE orders_id = '" . (int) $store_orders['orders_id'] . "'");
            smn_db_query("delete from " . TABLE_ORDERS_PRODUCTS . " WHERE orders_id = '" . (int) $store_orders['orders_id'] . "'");
            smn_db_query("delete from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " WHERE orders_id = '" . (int) $store_orders['orders_id'] . "'");
            smn_db_query("delete from " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " WHERE orders_id = '" . (int) $store_orders['orders_id'] . "'");
            smn_db_query("delete from " . TABLE_ORDERS_STATUS_HISTORY . " WHERE orders_id = '" . (int) $store_orders['orders_id'] . "'");
            smn_db_query("delete from " . TABLE_ORDERS_TOTAL . " WHERE orders_id = '" . (int) $store_orders['orders_id'] . "'");
        }
        //delete the stores image directory and files from the system
        $dir = DIR_FS_CATALOG . 'images/' . $prefix . '_images';
        smn_deldir($dir);
        /*
            //delete any saved orders in the DB tables associated with this store		
           $saved_store_order_query = smn_db_query("select saved_order_id from " . TABLE_SAVED_ORDERS . " WHERE saved_store_id = '". $prefix_id ."'");
           if (smn_db_num_rows($store_query)){	
              while ($saved_store_order = smn_db_fetch_array($saved_store_order_query)){
                 smn_db_query("delete from " . TABLE_SAVED_ORDERS_PRODUCTS . " where saved_order_id = '" . $saved_store_order['saved_order_id'] . "'");
                 smn_db_query("delete from " . TABLE_SAVED_ORDERS_PRODUCTS_ATTRIBUTES . " where saved_order_id = '" . $saved_store_order['saved_order_id'] . "'");
              }
                  
              smn_db_query("delete from " . TABLE_SAVED_ORDERS . " where saved_store_id = '". $prefix_id ."'");
           }*/
    }
    return $store_deleted = 'true';
}
开发者ID:stanislauslive,项目名称:StanMarket,代码行数:57,代码来源:delete_store_sql.php

示例10: smn_expire_specials

function smn_expire_specials()
{
    $specials_query = smn_db_query("select specials_id from " . TABLE_SPECIALS . " where status = '1' and now() >= expires_date and expires_date > 0");
    if (smn_db_num_rows($specials_query)) {
        while ($specials = smn_db_fetch_array($specials_query)) {
            smn_set_specials_status($specials['specials_id'], '0');
        }
    }
}
开发者ID:stanislauslive,项目名称:StanMarket,代码行数:9,代码来源:specials.php

示例11: template_setup

 function template_setup()
 {
     // set the template and theme parameters (can be modified through the administration interface)
     if (ALLOW_STORE_TEMPLATE == 'true') {
         $template_query = smn_db_query("select thema as themeKey, template_name as templateValue from " . TABLE_TEMPLATE . " where template_id = '" . TEMPLATE_ID . "'");
     } else {
         $template_query = smn_db_query("select thema as themeKey, template_name as templateValue from " . TABLE_TEMPLATE . " where template_id = '" . DEFAULT_TEMPLATE_ID . "'");
     }
     $this->template = smn_db_fetch_array($template_query);
 }
开发者ID:stanislauslive,项目名称:StanMarket,代码行数:10,代码来源:template_setup.php

示例12: remove

 function remove()
 {
     global $store_id;
     $keys = '';
     $keys_array = $this->keys();
     for ($i = 0; $i < sizeof($keys_array); $i++) {
         $keys .= "'" . $keys_array[$i] . "',";
     }
     $keys = substr($keys, 0, -1);
     smn_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in (" . $keys . ") and store_id = '" . $store_id . "'");
 }
开发者ID:stanislauslive,项目名称:StanMarket,代码行数:11,代码来源:freeshipper.php

示例13: paymentModuleInfo

 function paymentModuleInfo($pmInfo_array)
 {
     $this->payment_code = $pmInfo_array['payment_code'];
     for ($i = 0, $n = sizeof($pmInfo_array) - 1; $i < $n; $i++) {
         $key_value_query = smn_db_query("select configuration_title, configuration_value, configuration_description from " . TABLE_CONFIGURATION . " where configuration_key = '" . $pmInfo_array[$i] . "'");
         $key_value = smn_db_fetch_array($key_value_query);
         $this->keys[$pmInfo_array[$i]]['title'] = $key_value['configuration_title'];
         $this->keys[$pmInfo_array[$i]]['value'] = $key_value['configuration_value'];
         $this->keys[$pmInfo_array[$i]]['description'] = $key_value['configuration_description'];
     }
 }
开发者ID:stanislauslive,项目名称:StanMarket,代码行数:11,代码来源:payment_module_info.php

示例14: send

 function send($newsletter_id)
 {
     $mail_query = smn_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'");
     $mimemessage = new email(array('X-Mailer: oscMall bulk mailer'));
     $mimemessage->add_html($this->content);
     $mimemessage->build_message();
     while ($mail = smn_db_fetch_array($mail_query)) {
         $mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', EMAIL_FROM, $this->title);
     }
     $newsletter_id = smn_db_prepare_input($newsletter_id);
     smn_db_query("update " . TABLE_NEWSLETTERS . " set date_sent = now(), status = '1' where newsletters_id = '" . smn_db_input($newsletter_id) . "'");
 }
开发者ID:stanislauslive,项目名称:StanMarket,代码行数:12,代码来源:newsletter.php

示例15: smn_get_languages_directory

function smn_get_languages_directory($code)
{
    global $languages_id;
    $language_query = smn_db_query("select languages_id, directory from " . TABLE_LANGUAGES . " where code = '" . smn_db_input($code) . "'");
    if (smn_db_num_rows($language_query)) {
        $language = smn_db_fetch_array($language_query);
        $languages_id = $language['languages_id'];
        return $language['directory'];
    } else {
        return false;
    }
}
开发者ID:stanislauslive,项目名称:StanMarket,代码行数:12,代码来源:languages.php


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