本文整理汇总了PHP中mysql_exec函数的典型用法代码示例。如果您正苦于以下问题:PHP mysql_exec函数的具体用法?PHP mysql_exec怎么用?PHP mysql_exec使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mysql_exec函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_ppoints
/**
* function to get all Patronage Points details for a User
* [Params]
* $user_id = user
* $user_ppoints_id = to get a specific point data (leave empty to pull all data instead)
* $fetch_total_only = set as `true` to get total count only, instead of full data set from user_petronage_points table
*/
function get_ppoints($user_id, $user_ppoints_id = '', $fetch_total_only = false)
{
if ($user_id <= 0) {
return false;
}
if ($fetch_total_only != false) {
$sql_1 = "SELECT total_patronage_points FROM user_info WHERE user_id='{$user_id}'";
$upp_res = @mysql_exec($sql_1, 'single');
if (!is_array($upp_res) || count($upp_res) < 0) {
return false;
}
return (int) @$upp_res['total_patronage_points'];
} else {
$sql_1 = "SELECT * FROM user_petronage_points WHERE user_id='{$user_id}' ";
if ($user_ppoints_id > 0) {
$sql_1 .= " AND id='{$user_ppoints_id}'";
}
$sql_1 .= " ORDER BY received_on DESC";
$upp_res = @format_str(@mysql_exec($sql_1));
//var_dump("<pre>", $upp_res);
if (!is_array($upp_res) || count($upp_res) < 0) {
return false;
}
return $upp_res;
}
}
示例2: get_home_voices
function get_home_voices()
{
$home_voices = array();
$sql_1 = "SELECT uv.*, u.profile_pic\n FROM user_voices uv\n LEFT JOIN users u ON u.id=uv.user_id\n\n WHERE uv.is_blocked='0'\n ORDER BY RAND()\n LIMIT 20\n ";
$home_voices = @format_str(@mysql_exec($sql_1));
return $home_voices;
}
示例3: get_member_info
function get_member_info($member_id, $user_id)
{
if ($member_id <= 0) {
return false;
}
#/ All Fields
$fetch_fields = array('package_id', 'email_add', 'screen_name', 'profile_pic', 'first_name', 'middle_name', 'last_name', 'company_name', 'identify_by', 'joined_on', 'country_code', 'state', 'city', 'address_ln_1', 'address_ln_2', 'zip', 'phone_number');
#/ Get user_permission
$user_permissions = array();
$sql_1 = "SELECT fields_perm FROM user_permissions WHERE user_id='{$member_id}'";
$up_ar = @format_str(@mysql_exec($sql_1, 'single'));
if (is_array($up_ar) && array_key_exists('fields_perm', $up_ar)) {
$user_permissions = @explode(',', @$up_ar['fields_perm']);
}
#/ Filter fields based on permissions
if ($member_id != $user_id) {
if (!empty($user_permissions)) {
$fetch_fields = array_diff($fetch_fields, $user_permissions);
}
}
$fetch_fields_str = implode(',', $fetch_fields);
//var_dump("<pre>", $user_permissions, $fetch_fields, $fetch_fields_str); die();
if (empty($fetch_fields_str)) {
return false;
}
#/ Get Member's Info
$fetch_fields_str = str_replace('country_code', 'ui.country_code', $fetch_fields_str);
$sql_2 = "SELECT u.id as user_id,\n {$fetch_fields_str},\n (CASE\n WHEN identify_by='screen_name' THEN screen_name\n WHEN identify_by='full_name' THEN CONCAT(first_name, ' ', middle_name, ' ', last_name)\n WHEN identify_by='company_name' THEN company_name\n ELSE 'Member'\n END) AS user_ident,\n c.country_name,\n st.state_name\n\n FROM users u\n LEFT JOIN user_info ui ON ui.user_id=u.id\n LEFT JOIN countries c USING(country_code)\n LEFT JOIN states st ON st.state_code=ui.state\n\n WHERE u.id='{$member_id}'\n AND u.is_blocked='0'\n ";
$members_ar = @format_str(@mysql_exec($sql_2, 'single'));
//var_dump("<pre>", $members_ar); die();
return array($members_ar, $user_permissions);
}
示例4: update_permissions
function update_permissions($au_id, $permissions)
{
if (!is_array($permissions) || count($permissions) == 0) {
return false;
}
$sql_1 = "DELETE FROM admin_permissions WHERE admin_users_id='{$au_id}'";
$res = mysql_exec($sql_1, 'save');
//var_dump($res, mysql_error()); die();
insert_permissions($au_id, $permissions);
}
示例5: cust_order_status
function cust_order_status()
{
$sql_1 = "SELECT\n\n DISTINCT order_status,\n COUNT(*) AS t_os\n\n FROM cust_orders\n\n GROUP BY order_status\n ORDER BY t_os DESC\n LIMIT 10\n ";
$ret = '';
$result = @mysql_exec($sql_1);
if (count($result) > 0) {
$ret = @format_str($result);
#/ Set Gradient
$ret = color_pie_chart($ret);
}
return $ret;
}
示例6: get_package_info
function get_package_info($pk_id, $get_benefits = false)
{
if (empty($pk_id)) {
return false;
}
$sql_part = '';
if ($get_benefits != false) {
$sql_part = "";
}
$sql_1 = "SELECT title, cost, is_basic, is_recursive, recursive_cost\n FROM membership_packages mp\n WHERE is_active='1'\n AND id='{$pk_id}'\n ";
$package_info = @format_str(@mysql_exec($sql_1));
return $package_info;
}
示例7: query_limits
/**
* returns LIMITS - to be used in sql query
**/
function query_limits()
{
## Set Limits
$this->start = $this->GET['page'] * $this->lim;
##--
## Calculate Total
if (!isset($this->GET['tot'])) {
$r2 = mysql_exec($this->query);
$this->tot = count($r2);
} else {
$this->tot = $this->GET['tot'];
}
##--
return " LIMIT {$this->start}, {$this->lim}";
}
示例8: get_media
function get_media($pg_media)
{
$pg_media_csv = '';
if (@(!empty($pg_media)) && @is_array($pg_media)) {
$pg_media_csv = "'" . implode("','", $pg_media) . "'";
}
if (empty($pg_media_csv)) {
return false;
}
$sql_1 = "SELECT * FROM site_media WHERE placement_tag IN ({$pg_media_csv})";
$media = @mysql_exec($sql_1);
//var_dump("<pre>", $sql_1, $media); die();
if (is_array($media) && count($media) > 0) {
$media = cb89($media, 'placement_tag');
//var_dump("<pre>", $media); die();
return $media;
}
return false;
}
示例9: process_signup_3
function process_signup_3($POST, $FILES, $user_id)
{
global $seo_tag, $consts;
if ($user_id > 0) {
##/ Process Profile Pic
include_once '../includes/resize_images.php';
$up_path = "user_files/prof/{$user_id}/";
if (!is_dir($up_path)) {
mkdir($up_path, 0705, true);
}
$sql_prt = $profile_pic = '';
if (is_uploaded_file(@$_FILES['profile_pic']['tmp_name'])) {
$copy_data = array(0 => array('i_part' => '_th', 'size_w' => 35, 'size_h' => 35));
$profile_pic = upload_img_rs('profile_pic', 250, 250, $up_path, 'Profile Pic', '', 250, 'CUSA_MSG_GLOBAL', false, $copy_data);
if ($profile_pic != '') {
$sql_prt .= ", profile_pic='{$profile_pic}'";
}
}
//die('x');
#
#/save users
$sql_users = "UPDATE users SET\n screen_name='{$POST['screen_name']}', identify_by='{$POST['identify_by']}' {$sql_prt}\n WHERE id = '{$user_id}'";
@mysql_exec($sql_users, 'save');
#/save user_info
$sql_user_info = "UPDATE user_info SET\n country_code = '{$POST['country_code']}', state = '{$POST['state']}', city = '{$POST['city']}',\n \taddress_ln_1 = '{$POST['address_ln_1']}', address_ln_2 = '{$POST['address_ln_2']}',\n \tzip = '{$POST['zip']}', phone_number = '{$POST['phone_number']}'\n WHERE user_id = '{$user_id}'";
@mysql_exec($sql_user_info, 'save');
//die('x');
$_SESSION['signup_success'] = '2';
$_SESSION['signup_stage'] = 'signup-details';
reset_attempt_counts();
redirect_me('signup-details/success');
} else {
$_SESSION["CUSA_MSG_GLOBAL"] = array(false, 'Unable to process your request at this moment! Please try again later.');
redirect_me($seo_tag);
}
}
示例10: get_options
/**
* Get all Recursive Relationship into select field options
*
* @param $f1 = root/parent id
* @param $table_name = name of the table
* @param $dir = direction of breadcrumbs
*/
function get_options($f1, $table_name, $dir = 'left')
{
$frm = '';
$breadcr = '««';
if ($dir == 'right') {
$breadcr = '»»';
}
$sql = "select id, parent_id, title from {$table_name} where parent_id='{$f1}' order by sort_order";
//echo $sql;
$res = mysql_exec($sql);
if ($res !== false) {
foreach ($res as $k => $v) {
if ($v['parent_id'] != 0) {
$frm .= '<option value="' . $v['id'] . '">' . get_uppers($v['id'], $table_name, 'right') . '</option>';
}
$t1 = get_options($v['id'], $table_name, $dir);
if (!empty($t1) && $t1 != '0') {
$frm .= $t1;
}
}
//end foreach....
}
return $frm;
}
示例11: foreach
break;
case 'paid_on':
$orderby = '7';
break;
}
#/ Fill select-options
$pss_opts = '';
$payment_ss = @format_str(@mysql_exec("SELECT DISTINCT payment_status FROM user_payments GROUP BY payment_status ORDER BY payment_status"));
if (is_array($payment_ss) && count($payment_ss) > 0) {
foreach ($payment_ss as $cat_v) {
$pss_opts .= "<option value='{$cat_v['payment_status']}'>{$cat_v['payment_status']}</option>";
}
}
#/ Fill select-options
$gw_opts = '';
$gateway_ss = @format_str(@mysql_exec("SELECT DISTINCT gateway_name FROM user_payments GROUP BY gateway_name ORDER BY gateway_name"));
if (is_array($gateway_ss) && count($gateway_ss) > 0) {
foreach ($gateway_ss as $cat_v) {
$gw_opts .= "<option value='{$cat_v['gateway_name']}'>{$cat_v['gateway_name']}</option>";
}
}
?>
<tr>
<th width="2%" nowrap> </th>
<th valign="top" width="12%" nowrap><a href="<?php
echo rebuildurl(array("orderby" => 1, "orderdi" => $orderby == 1 && $orderdi == "ASC" ? "DESC" : "ASC"));
?>
">
Payment Invoice
示例12: getgpcvar
} else {
$param2 = '?';
}
$vc_id = (int) getgpcvar("vc_id", "G");
$cur_page = cur_page();
/////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
#### Get record if EDIT Mode
$empt = $empt_2 = $total = array();
$vote_list = '';
if ($vc_id && empty($empt)) {
$query = sprintf("SELECT vv.*, uv.question_text, u.email_add\n FROM user_voices uv\n RIGHT JOIN voices_votes vv ON vv.voice_id=uv.id\n LEFT JOIN users u ON u.id=vv.user_id\n WHERE voice_id='%d'\n ORDER BY voted_on DESC", $vc_id);
/*$token = mysql_query($query, $cn1); //or die(mysql_error($cn1));
$empt = @mysql_fetch_assoc($token);
$empt2 = $empt;*/
$empt = mysql_exec($query);
if ($empt == false || empty($empt)) {
die("Record Not Found !");
}
foreach ($empt as $empt_v) {
//var_dump($empt_v, '<br /><br />');
$vote_txt = ucwords(str_replace('_', ' ', $empt_v['vote_value']));
if (!array_key_exists($empt_v['vote_value'], $total)) {
$total[$empt_v['vote_value']] = array('title' => $vote_txt, 'count' => 1);
} else {
$total[$empt_v['vote_value']]['count']++;
}
$user = $empt_v['email_add'];
if (empty($user)) {
$user = 'Member';
}
示例13: format_str
<div style="width:130px; float:left;">Key:</div>
<div style="float:left;"><input type="text" id="action_key" name="action_key" maxlength="50" disabled="" value="<?php
echo format_str(@$empt['action_key']);
?>
" style="width:150px; border:1px solid #000261;" />
<span class="submsg"> for code</span>
</div>
<div style="clear:both; height:10px;"></div>
<div style="width:130px; float:left;">Category:</div>
<div style="float:left;">
<?php
$sql_cats = "SELECT DISTINCT category FROM patronage_points_config ORDER BY category";
$categories = mysql_exec($sql_cats);
?>
<select id="category" name="category" style="width:160px; border:1px solid #000261;">
<?php
if (@count($categories) > 0) {
foreach ($categories as $cat_v) {
echo "<option value=\"{$cat_v['category']}\">{$cat_v['category']}</option>";
}
}
?>
</select>
<?php
if (isset($empt['category'])) {
echo "<script>document.getElementById('category').value='{$empt['category']}';</script>";
}
?>
示例14: format_str
<div style="width:130px; float:left;">Setting / Value2:</div>
<div style="float:left;"><input type="text" id="content_settings" name="content_settings" maxlength="150" value="<?php
echo format_str(@$empt['content_settings']);
?>
" style="width:250px; border:1px solid #000261;" />
<span class="submsg"> for technical values only (will not be displayed) / please dont alter this</span><br /><br />
</div>
<div style="clear:both; height:15px;"></div>
<div style="width:130px; float:left;">Category:</div>
<div style="float:left;">
<?php
$sql_cats = "SELECT DISTINCT m_cat FROM site_misc_data ORDER BY m_cat";
$m_cats = mysql_exec($sql_cats);
?>
<span class="submsg">for reference and grouping only / will not be displayed</span><br /><br />
<div id="m_cat_select">
<select id="m_cat_sel" name="m_cat" onchange="toggle_cat(this, 'm_cat_field');">
<option value="-">-Please Select-</option>
<option value="other">{New Value}</option>
<?php
if (@count($m_cats) > 0) {
foreach ($m_cats as $m_catv) {
echo "<option value=\"{$m_catv['m_cat']}\">{$m_catv['m_cat']}</option>";
}
}
?>
</select>
<span style="color:#CC0000;"> *</span>
示例15: parseInt
<script>
$(document).ready(function(){
var body_ht = parseInt($('.section-main').outerHeight())+parseInt($('.mar-page').outerHeight());
$('#mask_1').css('height', (body_ht+90)+'px');
});
</script>
<?php
#/ get needed site_media
$sm_array = array('main_logo');
$site_media_main = get_site_media($sm_array);
//var_dump("<pre>", $site_media_main); die();
#/ get other needed info
$site_contact_info = @cb89(@mysql_exec("SELECT * FROM site_contact_info"), 'c_key');
//var_dump("<pre>", $site_contact_info); die();
?>
<div class="header">
<div class="container">
<?php
$site_top_logo = @$site_media_main['main_logo'];
?>
<div class="logo"><a href="<?php
echo DOC_ROOT;
?>
"><img src="<?php
echo DOC_ROOT;
?>
assets/images_2/media/<?php