當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DB_Functions::isUserIDExisted方法代碼示例

本文整理匯總了PHP中DB_Functions::isUserIDExisted方法的典型用法代碼示例。如果您正苦於以下問題:PHP DB_Functions::isUserIDExisted方法的具體用法?PHP DB_Functions::isUserIDExisted怎麽用?PHP DB_Functions::isUserIDExisted使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DB_Functions的用法示例。


在下文中一共展示了DB_Functions::isUserIDExisted方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: array

ini_set('default_charset', 'utf-8');
require_once 'include/DB_Functions.php';
$db = new DB_Functions();
// json response array
$response = array("error" => FALSE);
if (isset($_POST['userID']) && isset($_POST['building']) && isset($_POST['floor']) && isset($_POST['room'])) {
    // receiving the post params
    $userID = $_POST['userID'];
    $building = $_POST['building'];
    $floor = $_POST['floor'];
    $room = $_POST['room'];
    $company = $_POST['company'];
    $phone = $_POST['phone'];
    // check if user is already existed with this user_ID
    if ($db->isUserIDExisted($userID)) {
        // create a new user
        $userAddress = $db->updateUserAddress($userID, $building, $floor, $room, $company, $phone);
        if ($userAddress) {
            $response["error"] = FALSE;
            $response["userAddress"]["building"] = $userAddress["building"];
            $response["userAddress"]["floor"] = $userAddress["floor"];
            $response["userAddress"]["room"] = $userAddress["room"];
            $response["userAddress"]["company"] = $userAddress["company"];
            $response["userAddress"]["phone"] = $userAddress["phone"];
            echo json_encode($response, JSON_UNESCAPED_UNICODE);
        } else {
            // user failed to store
            $response["error"] = TRUE;
            $response["error_msg"] = "Unknown error occurred in updating address!";
            echo json_encode($response);
開發者ID:singtolee,項目名稱:PHP_END,代碼行數:30,代碼來源:updatingaddress.php

示例2: array

// json response array
$response = array("error" => FALSE);
if (isset($_POST['uid']) && isset($_POST['pnumber']) && isset($_POST['total'])) {
    // receiving the post params
    $uid = $_POST['uid'];
    $pm = $_POST['pm'];
    $dt = $_POST['dt'];
    $pnumber = $_POST['pnumber'];
    $total = $_POST['total'];
    $usecash = $_POST['usecash'];
    $usebalance = $_POST['usebalance'];
    $usepoints = $_POST['usepoints'];
    $outstanding = $_POST['outstanding'];
    $reward = $_POST['reward'];
    // check if user is already existed with this user_ID
    if ($db->isUserIDExisted($uid)) {
        // create a new user
        $order = $db->writeOrder($uid, $pm, $dt, $pnumber, $total, $usecash, $usebalance, $usepoints, $outstanding, $reward);
        if ($order) {
            $response["error"] = FALSE;
            $response["orderNo"]["order_ID"] = $order["order_ID"];
            $response["orderNo"]["user_ID"] = $order["user_ID"];
            echo json_encode($response, JSON_UNESCAPED_UNICODE);
            $db->updateBP($uid, $total, $usecash, $usebalance, $usepoints);
        } else {
            //failed
            $response["error"] = TRUE;
            $response["error_msg"] = "Unknown error occurred in submitting orders!";
            echo json_encode($response);
        }
    } else {
開發者ID:singtolee,項目名稱:PHP_END,代碼行數:31,代碼來源:submitorder.php


注:本文中的DB_Functions::isUserIDExisted方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。