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


PHP dbQuery函数代码示例

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


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

示例1: select

 public function select()
 {
     global $LANG;
     $sql = "SELECT\n\t\t\t\tiv.*,\n                p.description\n\t\t\tFROM \n\t\t\t\t" . TB_PREFIX . "products p\n\t\t\t\tLEFT JOIN " . TB_PREFIX . "inventory iv \n\t\t\t\t\tON (p.id = iv.product_id AND p.domain_id = iv.domain_id)\n\t\t\tWHERE \n\t\t\t\tiv.domain_id = :domain_id\n\t\t\tAND iv.id = :id;";
     $sth = dbQuery($sql, ':domain_id', $this->domain_id, ':id', $this->id);
     return $sth->fetch();
 }
开发者ID:dadigo,项目名称:simpleinvoices,代码行数:7,代码来源:inventory.php

示例2: register

function register($name, $email, $password)
{
    //check for user table
    //if it doesn't exist, create it (first time this script is run)
    //validation
    if (!isset($email)) {
        $response = array("status" => "fail", "resp" => "Please send afRegEmail ");
        return $response;
    }
    if (!isset($name)) {
        $response = array("status" => "fail", "resp" => "Please send a afRegName ");
        return $response;
    }
    if (!isset($password)) {
        $response = array("status" => "fail", "resp" => "Please send a afRegPassword ");
        return $response;
    }
    //encrpyt password
    $password = md5($password);
    $ipAddress = $_SERVER['REMOTE_ADDR'];
    //echo('ip='.$ipAddress);
    $allUsers = dbMassData("SELECT * FROM users WHERE email = '{$email}'");
    if ($allUsers == null) {
        dbQuery("INSERT INTO users (name, email, password, ipAddress) VALUES ('{$name}', '{$email}', '{$password}', '{$ipAddress}')");
        $resp = array("status" => "success");
        //now login user
        return $resp;
        //return $response;
    } else {
        $response = array("status" => "fail", "resp" => "emailTaken");
        return $response;
    }
}
开发者ID:bartuspan,项目名称:reslift,代码行数:33,代码来源:register.php

示例3: __construct

 /**
  * Constructor
  * @param Form $form
  * @param \samson\activerecord\field $db_field
  * @param string $locale
  */
 public function __construct(Form &$form, &$db_field, $field_type)
 {
     // Set field header name
     $this->name = !empty($db_field->Description) ? $db_field->Description : $db_field->Name;
     // Save pointers to database field object
     $this->db_field =& $db_field;
     // Call parent
     parent::__construct($form);
     // Prepare locales array with one default locale by default
     $locales = array('');
     // If field supports localization - set full locales array
     if ($db_field->local == 1) {
         $locales = SamsonLocale::$locales;
     }
     // Iterate defined locales
     if (sizeof(SamsonLocale::$locales)) {
         foreach ($locales as $locale) {
             // Try to find existing CMSMaterialField record
             if (!dbQuery('\\samson\\cms\\CMSMaterialField')->MaterialID($form->material->id)->FieldID($db_field->id)->locale($locale)->first($db_mf)) {
                 // Create CMSMaterialField record
                 $db_mf = new \samson\cms\CMSMaterialField(false);
                 $db_mf->Active = 1;
                 $db_mf->MaterialID = $this->form->material->id;
                 $db_mf->FieldID = $db_field->id;
                 $db_mf->locale = $locale;
                 $db_mf->save();
             }
             //elapsed($this->name.'-'.$locale.'-'.$db_mf->Value.'-'.$db_mf->id);
             // Add child tab
             $this->tabs[] = new MaterialFieldTab($form, $this, $db_mf, $locale, $field_type);
         }
     }
 }
开发者ID:rmolodyko,项目名称:material,代码行数:39,代码来源:MaterialFieldLocalizedTab.php

示例4: main

function main()
{
    if (hasPrivilege('customer')) {
        // Check customer Loged in
        $userId = $_SESSION[getSpKey()]['customer'];
        $sql = "SELECT * FROM `customers` WHERE `id` = '{$userId}' ";
        $result = dbQuery($sql);
        while (($records = mysql_fetch_assoc($result)) !== false) {
            $customerDetails = array('id' => $records['id'], 'customer_name' => $records['customer_name'], 'customer_family' => $records['customer_family'], 'customer_email' => $records['customer_email'], 'customer_gender' => $records['customer_gender'], 'customer_mobile' => $records['customer_mobile'], 'customer_city' => $records['customer_city'], 'customer_state' => $records['customer_state'], 'customer_zipcode' => $records['customer_zipcode'], 'customer_emergency_number' => $records['customer_emergency_number'], 'customer_address' => $records['customer_address']);
        }
        mysql_free_result($result);
        // edit Customer Details
        if (isset($_POST['btnEditSubmit'])) {
            $txtDetails = array('customer_name' => isset($_POST['txtName']) ? $_POST['txtName'] : null, 'customer_family' => isset($_POST['txtFamily']) ? $_POST['txtFamily'] : null, 'customer_email' => isset($_POST['txtEmail']) ? $_POST['txtEmail'] : null, 'customer_mobile' => isset($_POST['txtMobile']) ? $_POST['txtMobile'] : null, 'customer_city' => isset($_POST['txtCity']) ? $_POST['txtCity'] : null, 'customer_state' => isset($_POST['txtState']) ? $_POST['txtState'] : null, 'customer_zipcode' => isset($_POST['txtZipCode']) ? $_POST['txtZipCode'] : null, 'customer_emergency_number' => isset($_POST['txtEmergencyNumber']) ? $_POST['txtEmergencyNumber'] : null, 'customer_address' => isset($_POST['txtAddress']) ? $_POST['txtAddress'] : null);
            $dataIsCorrect = true;
            foreach ($txtDetails as $pieceOfData) {
                if (is_null($pieceOfData)) {
                    addMessage('اطلاعات محصول به درستی وارد نشده است', FAILURE);
                    $dataIsCorrect = false;
                    break;
                }
            }
        }
    } else {
        $url = BASE_URL . 'signup';
        return array('redirect' => $url);
    }
    $resp['data'] = array('customerDetails' => $customerDetails);
    return $resp;
}
开发者ID:mshahmalaki,项目名称:tahlildadeh-shop,代码行数:30,代码来源:detail.php

示例5: migrate

function migrate()
{
    #----------------------------------------------------------------------
    #--- Leave if we've done this migration already.
    if (!databaseTableExists('ResultsStatus')) {
        noticeBox(false, "You need to apply migation 1 first.");
        return;
    }
    #--- Leave if we are already up-to-date
    $number = dbQuery("\n              SELECT value FROM  ResultsStatus\n              WHERE  id = 'migration'\n  ");
    $number = $number[0]['value'];
    if ($number != '4') {
        noticeBox(false, "Wrong version number : " . $number . ". Must be 4");
        return;
    }
    #--- ResultsStatus table: Update migration number.
    reportAction("ResultsStatus", "Set migration number to 5");
    dbCommand("\n    UPDATE   ResultsStatus\n    SET    value = '5'\n    WHERE  id = 'migration'\n  ");
    #--- Apply the migration changes.
    alterTableCompetitions();
    alterTableCountries();
    alterTableContinents();
    #--- Yippie, we did it!
    noticeBox(true, "Migration completed.");
}
开发者ID:FatBoyXPC,项目名称:worldcubeassociation.org,代码行数:25,代码来源:migration5.php

示例6: alterTablePreregs

function alterTablePreregs()
{
    #----------------------------------------------------------------------
    #--- Alter the field set.
    reportAction("Preregs", "Alter field set");
    dbCommand("\n    ALTER TABLE Preregs\n      ADD    COLUMN `eventIds`  TEXT NOT NULL DEFAULT ''\n  ");
    $i = 0;
    $len = 1000;
    $preregs = dbQuery(" SELECT * FROM Preregs LIMIT {$i},{$len}");
    while (count($preregs) != 0) {
        foreach ($preregs as $prereg) {
            $id = $prereg['id'];
            $eventIds = '';
            foreach (array_merge(getAllEventIds(), getAllUnofficialEventIds()) as $eventId) {
                if ($prereg["E{$eventId}"] != 0) {
                    $eventIds .= "{$eventId} ";
                }
            }
            rtrim($eventIds);
            dbCommand("UPDATE Preregs SET eventIds='{$eventIds}' WHERE id='{$id}'");
        }
        $i += $len;
        $preregs = dbQuery(" SELECT * FROM Preregs LIMIT {$i},{$len}");
    }
    foreach (array_merge(getAllEventIds(), getAllUnofficialEventIds()) as $eventId) {
        dbCommand("ALTER TABLE Preregs\n                 DROP COLUMN `E{$eventId}`");
    }
}
开发者ID:FatBoyXPC,项目名称:worldcubeassociation.org,代码行数:28,代码来源:migration9.php

示例7: getRecentRanks

function getRecentRanks($sourceId)
{
    #----------------------------------------------------------------------
    global $WHERE, $sinceDateCondition;
    #--- Get all personal records sorted by event and value
    $records = dbQuery("\n    SELECT   personId, eventId, min({$sourceId}) value\n    FROM     Results result, Competitions competition\n    {$WHERE}   competition.id=competitionId\n      AND    {$sinceDateCondition}\n      AND    {$sourceId}>0\n    GROUP BY eventId, personId\n    ORDER BY eventId, value\n  ");
    #--- Append a sentinel
    $records[] = array('nobody', 'ThisWillCauseTheFinishEventCodeForTheLastEvent');
    #--- Process the personal records, build ranks[event][person]
    foreach ($records as $record) {
        list($personId, $eventId, $value) = $record;
        #--- At new events, finish the previous and reset for the new one
        if ($eventId != $currentEventId) {
            #--- Memorize the previous event's ranks (if any, and if that event is official)
            if ($currentEventId && in_array($currentEventId, getAllEventIds())) {
                $ranks[$currentEventId] = $ranksInCurrentEvent;
            }
            #--- Reset for the new event
            $currentEventId = $eventId;
            unset($currentSize, $currentRank, $currentValue, $ranksInCurrentEvent);
        }
        #--- Update the current event ranklist status
        $currentSize++;
        if ($value != $currentValue) {
            $currentValue = $value;
            $currentRank = $currentSize;
        }
        #--- Memorize the person's rank in this event
        $ranksInCurrentEvent[$personId] = $currentRank;
    }
    #--- Return the event ranks
    return $ranks;
}
开发者ID:FatBoyXPC,项目名称:worldcubeassociation.org,代码行数:33,代码来源:sum_of_recent_ranks.php

示例8: rewind

 public static function rewind($node, $sub_node = 0, $domain_id = '', $sub_node_2 = 0)
 {
     $domain_id = domain_id::get($domain_id);
     $sql = "UPDATE " . TB_PREFIX . "index \n                SET id = (id - 1) \n                WHERE node = :node\n\t\t\t\tAND sub_node = :sub_node\n\t\t\t\tAND sub_node_2 = :sub_node_2\n                AND domain_id = :domain_id\n\t\t\t";
     $sth = dbQuery($sql, ':node', $node, ':sub_node', $sub_node, ':sub_node_2', $sub_node_2, ':domain_id', $domain_id);
     return $sth;
 }
开发者ID:dadigo,项目名称:simpleinvoices,代码行数:7,代码来源:index.php

示例9: grouped

 function grouped($expense_id)
 {
     $sql = "select \n                    t.tax_description as tax_name, \n                    sum(et.tax_amount) as tax_amount,\n                    count(*) as count\n                from \n                    si_expense_item_tax et, \n                    si_expense e,\n                    si_tax t \n                where \n                    e.id = et.expense_id \n                AND \n                    t.tax_id = et.tax_id \n                AND\n                    e.id = :expense_id\n                GROUP BY \n                    t.tax_id;";
     $sth = dbQuery($sql, ':expense_id', $expense_id) or die(htmlsafe(end($dbh->errorInfo())));
     $result = $sth->fetchAll();
     return $result;
 }
开发者ID:alachaum,项目名称:simpleinvoices,代码行数:7,代码来源:expensetax.php

示例10: Privacy_register

/**
 * register, and login
 *
 * @return array status
 */
function Privacy_register()
{
    $password = $_REQUEST['password'];
    $token = $_REQUEST['token'];
    $reg = @$_SESSION['privacy']['registration'];
    $email = @$reg['email'];
    $custom = @$reg['custom'];
    if (!is_array($custom)) {
        $custom = array();
    }
    $sql = 'select id from user_accounts where email="' . addslashes($email) . '"';
    if (dbOne($sql, 'id')) {
        return array('error' => __('already registered'));
    }
    if ($token && $token == @$reg['token']) {
        $latlngsql = '';
        if (@$custom['_location']) {
            $latlng = dbRow('select lat,lng from locations where id=' . (int) $custom['_location']);
            if ($latlng) {
                $latlngsql = ',location_lat=' . $latlng['lat'] . ',location_lng=' . $latlng['lng'];
            }
        }
        $sql = 'insert into user_accounts set email="' . addslashes($email) . '",' . 'password=md5("' . addslashes($password) . '"),active=1,date_created=now(),' . 'extras="' . addslashes(json_encode($custom)) . '"' . $latlngsql;
        dbQuery($sql);
        return array('ok' => 1);
    } else {
        return array('error' => __('token does not match'));
    }
}
开发者ID:raylouis,项目名称:kvwebme,代码行数:34,代码来源:api.php

示例11: getLastValue

	function getLastValue() {
		$sql = "SELECT value FROM ".TB_PREFIX."customFieldValues WHERE customFieldId = 7 ORDER BY id DESC LIMIT 1;";
		$sth = dbQuery($sql);
		$result = $sth->fetch();
		error_log($sql);
		return $result['value'];
	}
开发者ID:CalhounGaming,项目名称:simpleinvoices,代码行数:7,代码来源:InvoiceNumber.php

示例12: ThemesApi_filesCheck

/**
 * check uploaded file to see if it's acceptable
 *
 * @param array $vars list of parameters
 *
 * @return boolean
 */
function ThemesApi_filesCheck($vars)
{
    /**
     * check if this file should be handled
     * by this plugin
     */
    $file = explode('/', $vars['requested_file']);
    $dir = $file[1];
    if ($file[1] != 'themes_api') {
        return true;
    }
    /**
     * if you are a moderator, then you can download
     */
    $id = $file[3];
    $moderated = dbOne('select moderated from themes_api where id=' . $id, 'moderated');
    if ($moderated == 'no') {
        die(__('This theme is awaiting moderation and has not been deemed as safe yet.'));
    }
    // save in database
    $referrer = @$_SERVER['HTTP_REFERER'];
    $ip = @$_SERVER['REMOTE_ADDR'];
    dbQuery('insert into themes_downloads values("",' . $id . ',"' . $referrer . '","' . $ip . '",now())');
    return false;
}
开发者ID:raylouis,项目名称:kvwebme,代码行数:32,代码来源:plugin.php

示例13: orderoldfood

function orderoldfood()
{
    if (isset($_POST)) {
        $food_id = $_POST['food_id'];
        $food_name = $_POST['food_name'];
        $food_type = $_POST['food_type'];
        $add_amount = $_POST['add_amount'];
        $price_per = $_POST['price_per'];
        $total = $add_amount * $price_per;
    }
    $conn = dbConnect();
    if ($conn) {
        $sql0 = "SELECT AMOUNT FROM EMM_ZOO.FM_STOCK WHERE FOODID = {$food_id};";
        $stm = dbQuery($conn, $sql0);
        while ($row = dbFetchArray($conn, $stm)) {
            $amountx = $row[0];
        }
        $amount_now = $amountx + $add_amount;
        $sql1 = "INSERT INTO EMM_ZOO.FOODANIMAL_EXPENSE (FOODEXPENSE_ID,DATES,FOODID,COST,RESPONPERSONID) VALUES (DEFAULT,CURRENT DATE,{$food_id},{$total},'5678');";
        $cb = db2_exec($conn, $sql1);
        $sql2 = "UPDATE EMM_ZOO.FM_STOCK SET AMOUNT = {$amount_now} WHERE FOODID = {$food_id};";
        $cc = db2_exec($conn, $sql2);
        if ($cc && $cb) {
            $resultMessage = 1;
            return $resultMessage;
            header('Location: FoodStock.php#food_list');
        } else {
            $resultMessage = 0;
            return $resultMessage;
        }
        db2_free_stmt($stmt);
        db2_close($conn);
    }
}
开发者ID:Juklabs,项目名称:emmaline,代码行数:34,代码来源:orderControl.php

示例14: main

function main()
{
    if (hasPrivilege('customer')) {
        //@ToDo اگر سبد خالی بود به صفحه اصلی ارسال شود
        $resp = array('data' => array(1));
        $resp['data']['shopingCart'] = array();
        $cartItems = array();
        if (isset($_SESSION['cart']) && count($_SESSION['cart']) > 0) {
            $productIds = array_keys($_SESSION['cart']);
            $temp = implode(', ', $productIds);
            $sql = "SELECT `id`, `product_name`,`product_picture_name`, `product_price` FROM `products` WHERE `id` IN ({$temp});";
            $result = dbQuery($sql);
            while (($row = mysql_fetch_assoc($result)) !== false) {
                $resp['data']['cartItems'][] = array('id' => $row['id'], 'product_name' => $row['product_name'], 'product_price' => (int) $row['product_price'], 'product_picture_name' => $row['product_picture_name'], 'count' => $_SESSION['cart'][(int) $row['id']]);
            }
            mysql_free_result($result);
        } else {
            $url = BASE_URL;
            return array('redirect' => $url);
        }
        return $resp;
    } else {
        addMessage('برای تسویه حساب وارد حساب کاربری خود شوید، چنانچه هنوز عضو نیستید ثبت نام کنید', NOTICE);
        $url = BASE_URL . 'signup';
        return array('redirect' => $url);
    }
}
开发者ID:mshahmalaki,项目名称:tahlildadeh-shop,代码行数:27,代码来源:index.php

示例15: grouped

 function grouped($expense_id)
 {
     $sql = "SELECT \n                      t.tax_description AS tax_name \n                    , SUM(et.tax_amount) AS tax_amount\n                    , COUNT(*) AS count\n                FROM \n                    " . TB_PREFIX . "expense_item_tax et \n\t\t\t\t\tINNER JOIN " . TB_PREFIX . "expense e \n\t\t\t\t\t\tON (e.id = et.expense_id)\n\t\t\t\t\tINNER JOIN " . TB_PREFIX . "tax t \n\t\t\t\t\t\tON (t.tax_id = et.tax_id AND t.domain_id = e.domain_id)\n                WHERE \n                    e.id = :expense_id\n\t\t\t\tAND e.domain_id = :domain_id\n                GROUP BY \n                    t.tax_id;";
     $sth = dbQuery($sql, ':expense_id', $expense_id, ':domain_id', $this->domain_id);
     $result = $sth->fetchAll();
     return $result;
 }
开发者ID:dadigo,项目名称:simpleinvoices,代码行数:7,代码来源:expensetax.php


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