本文整理汇总了PHP中olc_db_query函数的典型用法代码示例。如果您正苦于以下问题:PHP olc_db_query函数的具体用法?PHP olc_db_query怎么用?PHP olc_db_query使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了olc_db_query函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: olc_get_categoriesstatus_for_product
function olc_get_categoriesstatus_for_product($product_id)
{
$categorie_query = olc_db_query("\n\tSELECT\n\tcategories_id\n\tFROM " . TABLE_PRODUCTS_TO_CATEGORIES . "\n\tWHERE products_id=" . $product_id);
while ($categorie_data = olc_db_fetch_array($categorie_query)) {
return olc_check_categories_status($categorie_data['categories_id']) >= 1;
}
}
示例2: affiliate_insert
function affiliate_insert($sql_data_array, $affiliate_parent = 0)
{
// LOCK TABLES
// olc_db_query("LOCK TABLES " . TABLE_AFFILIATE . " WRITE");
if ($affiliate_parent > 0) {
$affiliate_root_query = olc_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 = olc_db_fetch_array($affiliate_root_query)) {
olc_db_query(SQL_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'] . BLANK);
olc_db_query(SQL_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;
olc_db_perform(TABLE_AFFILIATE, $sql_data_array);
$affiliate_id = olc_db_insert_id();
}
// no parent -> new root
} else {
$sql_data_array['affiliate_lft'] = '1';
$sql_data_array['affiliate_rgt'] = '2';
olc_db_perform(TABLE_AFFILIATE, $sql_data_array);
$affiliate_id = olc_db_insert_id();
olc_db_query(SQL_UPDATE . TABLE_AFFILIATE . " set affiliate_root = '" . $affiliate_id . "' where affiliate_id = '" . $affiliate_id . "' ");
}
// UNLOCK TABLES
olc_db_query("UNLOCK TABLES");
return $affiliate_id;
}
示例3: olc_get_download
function olc_get_download($content_id)
{
$content_query = olc_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 . APOS);
$content_data = olc_db_fetch_array($content_query);
// update file counter
olc_db_query("SQL_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 . APOS);
// 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(BLANK, '', $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);
}
}
}
示例4: olc_get_countries
function olc_get_countries($countries_id = '', $with_iso_codes = false)
{
$countries_id_text = 'countries_id';
$countries_name_text = 'countries_name';
$select = "select countries_name";
$select_countries_id = $select . ", " . $countries_id_text;
$from = " from " . TABLE_COUNTRIES;
$countries_array = array();
if (olc_not_null($countries_id)) {
$where = $from . " where countries_id = '" . $countries_id . APOS;
if ($with_iso_codes) {
$countries_iso_code_text = 'countries_iso_code_';
$countries_iso_code_2_text = $countries_iso_code_text . '2';
$countries_iso_code_3_text = $countries_iso_code_text . '3';
$countries = olc_db_query($select_countries_id . ", " . $countries_iso_code_2_text . $where);
$countries_values = olc_db_fetch_array($countries);
$countries_array = array($countries_name_text => $countries_values[$countries_name_text], $countries_iso_code_2_text => $countries_values[$countries_iso_code_2_text], $countries_iso_code_3_text => $countries_values[$countries_iso_code_3_text]);
} else {
$countries = olc_db_query($select . $where);
$countries_values = olc_db_fetch_array($countries);
$countries_array = array($countries_name_text => $countries_values[$countries_name_text]);
}
} else {
$countries = olc_db_query($select_countries_id . $from . " order by " . $countries_name_text);
while ($countries_values = olc_db_fetch_array($countries)) {
$countries_array[] = array($countries_id_text => $countries_values[$countries_id_text], $countries_name_text => $countries_values[$countries_name_text]);
}
}
return $countries_array;
}
示例5: olc_address_label
function olc_address_label($customers_id, $address_id = 1, $html = false, $boln = '', $eoln = NEW_LINE)
{
$address_query = olc_db_query("\n\t\tselect\n\t\tentry_firstname as firstname,\n\t\tentry_lastname as lastname,\n\t\tentry_company as company,\n\t\tentry_street_address as street_address,\n\t\tentry_suburb as suburb,\n\t\tentry_city as city,\n\t\tentry_postcode as postcode,\n\t\tentry_state as state,\n\t\tentry_zone_id as zone_id,\n\t\tentry_country_id as country_id\n\t\tfrom " . TABLE_ADDRESS_BOOK . "\n\t\twhere customers_id = '" . $customers_id . "' and address_book_id = '" . $address_id . APOS);
$address = olc_db_fetch_array($address_query);
$format_id = olc_get_address_format_id($address['country_id']);
return olc_address_format($format_id, $address, $html, $boln, $eoln);
}
示例6: get_category_tree
function get_category_tree($parent_id = '0', $spacing = EMPTY_STRING, $exclude = EMPTY_STRING, $category_tree_array = EMPTY_STRING, $include_itself = false, $cPath = EMPTY_STRING)
{
if ($parent_id == 0) {
$cPath = EMPTY_STRING;
} else {
$cPath .= $parent_id . '_';
}
if (!is_array($category_tree_array)) {
$category_tree_array = array();
}
if (sizeof($category_tree_array) < 1 && $exclude != '0') {
$category_tree_array[] = array('id' => '0', 'text' => TEXT_TOP);
}
if ($include_itself) {
$category_query = olc_db_query("\n\t\t\tselect cd.categories_name\n\t\t\tfrom " . TABLE_CATEGORIES_DESCRIPTION . " cd\n\t\t\tWHERE c.categories_status = '1' AND cd.language_id = '" . SESSION_LANGUAGE_ID . "'\n\t\t\tand cd.categories_id = '" . $parent_id . APOS);
$category = olc_db_fetch_array($category_query);
$category_tree_array[] = array('id' => $parent_id, 'text' => $category['categories_name']);
}
$categories_query = olc_db_query("\n\t\tselect\n\t\tc.categories_id,\n\t\tcd.categories_name,\n\t\tc.parent_id\n\t\tfrom " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd\n\t\twhere c.categories_id = cd.categories_id\n\t\tand cd.language_id = '" . SESSION_LANGUAGE_ID . "'\n\t\tand c.parent_id = '" . $parent_id . "'\n\t\tand c.categories_status = '1'\n\t\torder by c.sort_order, cd.categories_name");
while ($categories = olc_db_fetch_array($categories_query)) {
$categories_id = $categories['categories_id'];
if ($exclude != $categories_id) {
$category_tree_array[] = array('id' => $categories_id, 'text' => $spacing . $categories['categories_name'], 'link' => olc_href_link(FILENAME_DEFAULT, 'cPath=' . $cPath . $categories_id, NONSSL, false, true, false), 'pcount' => olc_count_products_in_category($categories_id));
$category_tree_array = get_category_tree($categories_id, $spacing . ' ', $exclude, $category_tree_array, false, $cPath);
}
}
return $category_tree_array;
}
示例7: olc_random_select
function olc_random_select($query, $rows = 1)
{
global $random_rows;
$random_product = '';
$random_query = olc_db_query($query);
$num_rows = olc_db_num_rows($random_query);
if ($num_rows > 1) {
$num_rows1 = $num_rows - 1;
for ($row = 1; $row <= $rows; $row++) {
$tries = 0;
$random_row = olc_rand(0, $num_rows1);
$random_row_store = "|" . $random_row . "|";
$include_row = true;
while (!(strpos($random_rows, $random_row_store) === false)) {
$tries++;
if ($tries > 10) {
$include_row = false;
break;
} else {
$random_row = olc_rand(0, $num_rows1);
}
}
if ($include_row) {
$random_rows .= $random_row_store;
olc_db_data_seek($random_query, $random_row);
$random_product[] = olc_db_fetch_array($random_query);
}
}
} else {
if ($num_rows > 0) {
$random_product[] = olc_db_fetch_array($random_query);
}
}
return $random_product;
}
示例8: olc_get_products_special_price
function olc_get_products_special_price($product_id)
{
global $special_info;
$product_query = olc_db_query("select specials_new_products_price, expires_date from " . TABLE_SPECIALS . " where products_id = '" . $product_id . "' and status");
$special_info = olc_db_fetch_array($product_query);
return $special_info['specials_new_products_price'];
}
示例9: olc_get_vpe_name
function olc_get_vpe_name($vpeID)
{
$vpe_query = "SELECT products_vpe_name FROM " . TABLE_PRODUCTS_VPE . " WHERE language_id='" . SESSION_LANGUAGE_ID . "' and products_vpe_id='" . $vpeID . APOS;
$vpe_query = olc_db_query($vpe_query);
$vpe = olc_db_fetch_array($vpe_query);
return $vpe['products_vpe_name'];
}
示例10: olc_display_banner
function olc_display_banner($action, $identifier)
{
if ($action == 'dynamic') {
$banners_query = olc_db_query(SELECT_COUNT . " as count from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . $identifier . APOS);
$banners = olc_db_fetch_array($banners_query);
if ($banners['count'] > 0) {
$banner = olc_random_select("select banners_id, banners_title, banners_image, banners_html_text from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . $identifier . APOS);
} else {
return '<b>OLC ERROR! (olc_display_banner(' . $action . ', ' . $identifier . ') -> No banners with group \'' . $identifier . '\' found!</b>';
}
} elseif ($action == 'static') {
if (is_array($identifier)) {
$banner = $identifier;
} else {
$banner_query = olc_db_query("select banners_id, banners_title, banners_image, banners_html_text from " . TABLE_BANNERS . " where status = '1' and banners_id = '" . $identifier . APOS);
if (olc_db_num_rows($banner_query)) {
$banner = olc_db_fetch_array($banner_query);
} else {
return '<b>OLC ERROR! (olc_display_banner(' . $action . ', ' . $identifier . ') -> Banner with id \'' . $identifier . '\' not found, or status inactive</b>';
}
}
} else {
return '<b>OLC ERROR! (olc_display_banner(' . $action . ', ' . $identifier . ') -> Unknown $action parameter value - it must be either \'dynamic\' or \'static\'' . HTML_B_END;
}
if (olc_not_null($banner['banners_html_text'])) {
$banner_string = $banner['banners_html_text'];
} else {
$banner_string = HTML_A_START . olc_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banner['banners_id']) . '" target="_blank">' . olc_image(DIR_WS_IMAGES . 'banner/' . $banner['banners_image'], $banner['banners_title']) . HTML_A_END;
}
olc_update_banner_display_count($banner['banners_id']);
return $banner_string;
}
示例11: olc_get_products_stock
function olc_get_products_stock($products_id)
{
$products_id = olc_get_prid($products_id);
$stock_query = olc_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . $products_id . APOS);
$stock_values = olc_db_fetch_array($stock_query);
return $stock_values['products_quantity'];
}
示例12: query
function query($order_id)
{
$order_query = olc_db_query("\n\t\tselect\n\t\tcustomers_name,\n\t\tcustomers_cid,\n\t\tcustomers_id,\n\t\tcustomers_company,\n\t\tcustomers_street_address,\n\t\tcustomers_suburb,\n\t\tcustomers_city,\n\t\tcustomers_postcode,\n\t\tcustomers_state,\n\t\tcustomers_country,\n\t\tcustomers_telephone,\n\t\tcustomers_email_address,\n\t\tcustomers_address_format_id,\n\t\tdelivery_name,\n\t\tdelivery_company,\n\t\tdelivery_street_address,\n\t\tdelivery_suburb,\n\t\tdelivery_city,\n\t\tdelivery_postcode,\n\t\tdelivery_state,\n\t\tdelivery_country,\n\t\tdelivery_address_format_id,\n\t\tbilling_name,\n\t\tbilling_company,\n\t\tbilling_street_address,\n\t\tbilling_suburb,\n\t\tbilling_city,\n\t\tbilling_postcode,\n\t\tbilling_state,\n\t\tbilling_country,\n\t\tbilling_address_format_id,\n\t\tbilling_invoice_number,\n\t\tpayment_method,\n\t\tcc_type,\n\t\tcc_owner,\n\t\tcc_number,\n\t\tcc_expires,\n\t\tcomments,\n\t\tcurrency,\n\t\tcurrency_value,\n\t\tdate_purchased,\n\t\torders_status,\n\t\torders_trackcode,\n\t\tlast_modified,\n\t\tpayment_id,\n\t\tcustomers_status,\n\t\tcustomers_status_name,\n\t\tcustomers_status_image,\n\t\tcustomers_ip,\n\t\tlanguage,\n\t\tcustomers_status_discount\n\t\tfrom " . TABLE_ORDERS . " where\n\t\torders_id = '" . olc_db_input($order_id) . APOS);
$order = olc_db_fetch_array($order_query);
$totals_query = olc_db_query("select title, text from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . olc_db_input($order_id) . "' order by sort_order");
while ($totals = olc_db_fetch_array($totals_query)) {
$this->totals[] = array('title' => $totals['title'], 'text' => $totals['text']);
}
$this->info = array('order_id' => $order_id, 'currency' => $order['currency'], 'currency_value' => $order['currency_value'], 'payment_method' => $order['payment_method'], 'status' => $order['customers_status'], 'status_name' => $order['customers_status_name'], 'status_image' => $order['customers_status_image'], 'status_discount' => $order['customers_status_discount'], 'cc_type' => $order['cc_type'], 'cc_owner' => $order['cc_owner'], 'cc_number' => $order['cc_number'], 'cc_expires' => $order['cc_expires'], 'comments' => $order['comments'], 'language' => $order['language'], 'date_purchased' => $order['date_purchased'], 'payment_id' => $order['payment_id'], 'orders_status' => $order['orders_status'], 'orders_trackcode' => $order['orders_trackcode'], 'last_modified' => $order['last_modified']);
$this->customer = array('name' => $order['customers_name'], 'id' => $order['customers_id'], 'company' => $order['customers_company'], 'csID' => $order['customers_cid'], 'shop_id' => $order['shop_id'], 'id' => $order['customers_id'], 'cIP' => $order['customers_ip'], 'street_address' => $order['customers_street_address'], 'suburb' => $order['customers_suburb'], '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'], 'suburb' => $order['delivery_suburb'], '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'], 'suburb' => $order['billing_suburb'], 'city' => $order['billing_city'], 'postcode' => $order['billing_postcode'], 'state' => $order['billing_state'], 'country' => $order['billing_country'], 'format_id' => $order['billing_address_format_id'], 'billing_invoice_number' => $order['billing_invoice_number']);
$index = 0;
$orders_products_query = olc_db_query("\n\t\t\tselect\n\t\t\torders_products_id,\n\t\t\tproducts_name,\n\t\t\tproducts_id,\n\t\t\tproducts_model,\n\t\t\tproducts_price,\n\t\t\tproducts_tax,\n\t\t\tproducts_quantity,\n\t\t\tfinal_price,\n\t\t\tallow_tax,\n\t\t\tproducts_discount_made\n\t\t\tfrom " . TABLE_ORDERS_PRODUCTS . "\n\t\t\twhere\n\t\t\torders_id ='" . olc_db_input($order_id) . APOS);
while ($orders_products = olc_db_fetch_array($orders_products_query)) {
$this->products[$index] = array('id' => $orders_products['products_id'], 'orders_products_id' => $orders_products['orders_products_id'], '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'], 'discount' => $orders_products['products_discount_made'], 'final_price' => $orders_products['final_price'], 'allow_tax' => $orders_products['allow_tax'], 'auctionid' => $orders_products['auctionid']);
$subindex = 0;
$attributes_query = olc_db_query("\n\t\t\t\tselect\n\t\t\t\tproducts_options,\n\t\t\t\tproducts_options_values,\n\t\t\t\tproducts_options_id,\n\t\t\t\tproducts_options_values_id,\n\t\t\t\toptions_values_price,\n\t\t\t\tprice_prefix from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . olc_db_input($order_id) . "' and orders_products_id = '" . $orders_products['orders_products_id'] . APOS);
if (olc_db_num_rows($attributes_query)) {
while ($attributes = olc_db_fetch_array($attributes_query)) {
$this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'], 'value' => $attributes['products_options_values'], 'option_id' => $attributes['products_options_id'], 'value_id' => $attributes['products_options_values_id'], 'prefix' => $attributes['price_prefix'], 'price' => $attributes['options_values_price']);
$subindex++;
}
}
$index++;
}
}
示例13: olc_get_path
function olc_get_path($current_category_id = EMPTY_STRING)
{
global $cPath_array;
if (olc_not_null($current_category_id)) {
$cp_size = sizeof($cPath_array);
if ($cp_size == 0) {
$cPath_new = $current_category_id;
} else {
$cPath_new = EMPTY_STRING;
$sql0 = "select parent_id from " . TABLE_CATEGORIES . " where categories_id = '#'";
$sql = str_replace(HASH, $cPath_array[$cp_size - 1], $sql0);
$last_category_query = olc_db_query($sql);
$last_category = olc_db_fetch_array($last_category_query);
$sql = str_replace(HASH, $current_category_id, $sql0);
$current_category_query = olc_db_query($sql);
$current_category = olc_db_fetch_array($current_category_query);
if ($last_category['parent_id'] == $current_category['parent_id']) {
for ($i = 0, $n = $cp_size - 1; $i < $n; $i++) {
$cPath_new .= UNDERSCORE . $cPath_array[$i];
}
} else {
for ($i = 0; $i < $cp_size; $i++) {
$cPath_new .= UNDERSCORE . $cPath_array[$i];
}
}
$cPath_new .= UNDERSCORE . $current_category_id;
if (substr($cPath_new, 0, 1) == UNDERSCORE) {
$cPath_new = substr($cPath_new, 1);
}
}
} else {
$cPath_new = implode(UNDERSCORE, $cPath_array);
}
return 'cPath=' . $cPath_new;
}
示例14: 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 = olc_db_query("select count(*) as total " . substr($sql_query, $pos_from, $pos_to - $pos_from));
$reviews_count = olc_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;
}
示例15: olc_oe_get_allow_tax
function olc_oe_get_allow_tax($customers_id)
{
$customer_query = olc_db_query("select customers_status from " . TABLE_CUSTOMERS . " where customers_id = '" . $customers_id . APOS);
$customer = olc_db_fetch_array($customer_query);
$allow_query = olc_db_query("select customers_status_show_price_tax from " . TABLE_CUSTOMERS_STATUS . " where customers_status_id = '" . $customer['customers_status'] . APOS);
$allow = olc_db_fetch_array($allow_query);
return $allow['customers_status_show_price_tax'];
}