本文整理汇总了PHP中query_despace函数的典型用法代码示例。如果您正苦于以下问题:PHP query_despace函数的具体用法?PHP query_despace怎么用?PHP query_despace使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了query_despace函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_nav_category
function get_nav_category($id = null)
{
$return = array();
$query = 'select `category_id`,`category_name` from category where `categoryarea_id` = ' . $id . ' AND `category_status` = "open" order by `category_priority` asc ;';
$query = query_despace($query);
$result = mysql_query($query);
//有'項目'才填充資料 - 讓左側的category項目填滿不用limit
if (mysql_num_rows($result) > 0) {
$nav_category = array();
while ($row = mysql_fetch_array($result)) {
$nav_category['id'] = $row['category_id'];
$nav_category['name'] = $row['category_name'];
$return[] = $nav_category;
}
}
return $return;
}
示例2: json_encode_return
<?php
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
$value = !empty($_POST['value']) ? $_POST['value'] : null;
if ($value == null) {
json_encode_return(0, '未輸入內容');
}
$value = stripslashes(htmlspecialchars($value));
$new_id = 3;
$query = 'UPDATE `about` SET `value` = \'' . $value . '\' , `modify_name` = "' . $_SESSION['admin']['name'] . '" ,`modify_time` = NOW() WHERE `about`.`id` = "' . $new_id . '" LIMIT 1 ; ';
$query = query_despace($query);
$result = mysql_query($query);
!$result ? json_encode_return(0, '修改失敗,請確認您輸入的資料是否有誤', URL_ADMIN2_ROOT . 'about') : json_encode_return(1, '修改成功', URL_ADMIN2_ROOT . 'about');
}
header('Content-type: text/html; charset=utf-8');
header('Location: http://' . $_SERVER['SERVER_NAME']);
示例3: query_despace
<!DOCTYPE html>
<html>
<?php
include '../head.php';
?>
<body class="hold-transition skin-blue sidebar-mini">
<!-- Site wrapper -->
<div class="wrapper">
<?php
include '../header.php';
?>
<?php
include '../navbar.php';
?>
<?php
$query = query_despace('select * from `contact` where status != "delete" order by `inserttime` desc;');
$result = mysql_query($query);
$data = array();
$a_contact_open = array();
$a_contact_archive = array();
while ($row = mysql_fetch_assoc($result)) {
$data[] = $row;
}
foreach ($data as $k => $v) {
$v['read'] = $data[$k]['read'] == 'read' ? '<span class="label label-success">Read</span>' : '<span class="label label-warning">Unread</span>';
if ($v['status'] == 'open') {
$a_contact_open[] = $v;
} else {
$a_contact_archive[] = $v;
}
}
示例4: get_product_id
function get_product_id(array $category_id)
{
$query = 'select `product_id` from product where `product_status` != "delete" and product_category_id IN (' . implode(',', $category_id) . ') ;';
$query = query_despace($query);
$result = mysql_query($query);
$product_id_list = array();
while ($row = mysql_fetch_assoc($result)) {
$product_id_list[] = $row['product_id'];
}
return !empty($product_id_list) ? $product_id_list : null;
}
示例5: query_despace
<!DOCTYPE html>
<html>
<?php
include '../head.php';
?>
<body class="hold-transition skin-blue sidebar-mini">
<!-- Site wrapper -->
<div class="wrapper">
<?php
include '../header.php';
?>
<?php
include '../navbar.php';
?>
<?php
$query = query_despace('select * from `admin`;');
$result = mysql_query($query);
if (!$result) {
redirect_php(URL_ADMIN2_ROOT);
}
$a_admin = array();
while ($row = mysql_fetch_assoc($result)) {
$a_admin[] = $row;
}
?>
<div class="content-wrapper">
<section class="content-header">
<div class="box-body"><h2>管理員設定</h2></div>
<h1>
<small><p class="text-light-blue">(若不需修改密碼請將該欄位留空)</p></small>
</h1>
示例6: del_product_meta
function del_product_meta(array $product_id_list)
{
$query = 'DELETE FROM product_meta WHERE product_id IN (' . implode(',', $product_id_list) . ') ;';
$query = query_despace($query);
return mysql_query($query);
}
示例7: query_despace
$num = 20;
$start_page = ($page - 1) * $num;
//只取有`category`的area且ID不重複
$query = 'select DISTINCT `categoryarea`.`categoryarea_id` AS id , `categoryarea`.`categoryarea_name` AS name, `categoryarea`.`categoryarea_description` AS description ,`categoryarea`.`categoryarea_cover` AS cover
from category inner join `categoryarea` on `categoryarea`.`categoryarea_id` = `category`.`categoryarea_id`
where `categoryarea_status` = "open" and `category`.`category_id` != "" and `category`.`category_status` = "open"
order by `categoryarea_priority`
asc limit ' . $start_page . ',' . $num . ';';
$query = query_despace($query);
$result = mysql_query($query);
$n_query = $query = 'select DISTINCT `categoryarea`.`categoryarea_id` AS id , `categoryarea`.`categoryarea_name` AS name, `categoryarea`.`categoryarea_description` AS description ,`categoryarea`.`categoryarea_cover` AS cover
from category inner join `categoryarea` on `categoryarea`.`categoryarea_id` = `category`.`categoryarea_id`
where `categoryarea_status` = "open" and `category`.`category_id` != "" and `category`.`category_status` = "open"
order by `categoryarea_priority`
asc ;';
$n_query = query_despace($n_query);
$n_result = mysql_query($n_query);
$num_rows = mysql_num_rows($n_result);
if (!$result) {
echo 'Error!';
exit;
}
$categoryarea = array();
$n = 1;
while ($row = mysql_fetch_array($result)) {
$categoryarea[$n]['categoryarea_id'] = $row['id'];
$categoryarea[$n]['categoryarea_name'] = $row['name'];
$categoryarea[$n]['categoryarea_description'] = $row['description'];
$categoryarea[$n]['categoryarea_cover'] = $row['cover'];
$n++;
}
示例8: json_encode_return
<?php
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
$data = !empty($_POST['data']) ? $_POST['data'] : null;
if ($data == null) {
json_encode_return(0, '未輸入內容');
}
$data = json_decode($data, true);
/**
* v0[0] => admin_account, v0[1] => admin_password , v0[2] => admin_name , v0[3] => admin_email , v0[4] => id
*/
foreach ($data as $k0 => $v0) {
$query = 'update `admin` set `admin_account` = "' . $v0[0] . '",';
if (!empty($v0[1]) && $v0[1] != '') {
$query .= '`admin_password` = "' . $v0[1] . '",';
}
$query .= '`admin_name` = "' . $v0[2] . '", `admin_email` = "' . $v0[3] . '" where `id` = "' . $v0[4] . '" ;';
$result = mysql_query(query_despace($query));
if (!$result) {
json_encode_return(0, '修改失敗. [Error id:' . $v0[4] . ']', URL_ADMIN2_ROOT . 'system/admin.php');
}
}
json_encode_return(1, '修改成功', URL_ADMIN2_ROOT . 'system/admin.php');
}
header('Content-type: text/html; charset=utf-8');
header('Location: http://' . $_SERVER['SERVER_NAME']);
示例9: get_product_url
/**
* 0108 透過product_id取得前台產品的連結網址
*/
function get_product_url($id = null)
{
$return = null;
if ($id != null) {
$query = query_despace('select * from `product` where `product_id` = ' . $id . ' ;');
$result = mysql_query($query);
$product = mysql_fetch_assoc($result);
if (empty($product)) {
return $return;
}
$query = query_despace('select * from `category` where `category_status` = "open" and `category_id` = ' . $product['product_category_id'] . ' ;');
$result = mysql_query($query);
$category = mysql_fetch_assoc($result);
if (empty($category)) {
return $return;
}
$query = query_despace('select * from `categoryarea` where `categoryarea_status` = "open" and `categoryarea_id` = ' . $category['categoryarea_id'] . ' ;');
$result = mysql_query($query);
$categoryarea = mysql_fetch_assoc($result);
if (empty($categoryarea)) {
return $return;
}
$param = 'goods=' . base64_encode($categoryarea['categoryarea_id']) . '&category=' . base64_encode($category['category_id']) . '&items=' . base64_encode($product['product_id']);
$return = '<a target="_blank" href="' . URL_ROOT . 'product?' . $param . '">' . $product['product_name'] . '</a>';
}
return $return;
}
示例10: json_encode_return
<?php
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
$contact_id = !empty($_POST['contact_id']) ? $_POST['contact_id'] : null;
$act = !empty($_POST['act']) ? $_POST['act'] : null;
if ($contact_id == null || $act == null) {
json_encode_return(0, '[Error] 資料錯誤請重新操作');
}
switch ($act) {
case 'archive':
$query = query_despace('UPDATE `contact` SET `status` = "archive" where `id` = "' . $contact_id . '" limit 1');
$result = mysql_query($query);
!$result ? json_encode_return(0, '修改失敗,請確認您輸入的資料是否有誤', URL_ADMIN2_ROOT . 'contact/content.php?contact_id=' . $contact_id) : json_encode_return(1, '修改成功', URL_ADMIN2_ROOT . 'contact/content.php?contact_id=' . $contact_id);
break;
case 'delete':
$query = query_despace('UPDATE `contact` SET `status` = "delete" where `id` = "' . $contact_id . '" limit 1');
$result = mysql_query($query);
!$result ? json_encode_return(0, '刪除資料失敗,請確認您輸入的資料是否有誤', URL_ADMIN2_ROOT . 'contact') : json_encode_return(1, '刪除資料成功', URL_ADMIN2_ROOT . 'contact');
break;
}
}
header('Content-type: text/html; charset=utf-8');
header('Location: http://' . $_SERVER['SERVER_NAME']);