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


PHP DB_Functions類代碼示例

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


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

示例1: processForm

function processForm()
{
    $db = new DB_Functions();
    $error_msg = "";
    //validate user input
    if ($_POST['companyName'] == "") {
        printForm();
        echo "Invalid Company Name.\n";
        return;
    } else {
        if ($_POST['lastTradedPrice'] == "") {
            printForm();
            echo "Invalid Last Traded Price Value.\n";
            return;
        } else {
            if ($_POST['previousPrice'] == "") {
                printForm();
                echo "Invalid Previous Price Value.\n";
                return;
            }
        }
    }
    //save data to table
    $change = $_POST['lastTradedPrice'] - $_POST['previousPrice'];
    $result = $db->addShareListingEntry($_POST['companyName'], $_POST['lastTradedPrice'], $_POST['previousPrice'], $change);
    if (!$result == false) {
        //data was successfully saved to database
        header('Location: http://localhost/eserver/account.php');
    } else {
        $error_msg = "Data could not be saved in database.\n";
        printForm();
    }
}
開發者ID:zuozhiyu,項目名稱:BankingApp-Server,代碼行數:33,代碼來源:createAShareListing.php

示例2: send_notification

 /**
  * Sending Push Notification
  */
 public function send_notification($title, $message)
 {
     // include config
     include_once './config.php';
     include_once './db_functions.php';
     $db = new DB_Functions();
     $ids = $db->getRegisteredIds();
     // Set POST variables
     $url = 'https://android.googleapis.com/gcm/send';
     $fields = array('registration_ids' => $ids, 'notification' => array('title' => $title, 'body' => $message));
     $headers = array('Authorization: key=' . GOOGLE_API_KEY, 'Content-Type: application/json');
     // Open connection
     $ch = curl_init();
     // Set the url, number of POST vars, POST data
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_POST, true);
     curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     // Disabling SSL Certificate support temporarly
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
     // Execute post
     $result = curl_exec($ch);
     if ($result === FALSE) {
         die('Curl failed: ' . curl_error($ch));
     }
     // Close connection
     curl_close($ch);
     echo $result;
 }
開發者ID:callmegoon,項目名稱:digital-summit-app,代碼行數:33,代碼來源:gcm.php

示例3: getUltimoPacienteId

function getUltimoPacienteId()
{
    require_once 'include/DB_Functions.php';
    $db = new DB_Functions();
    $id = $db->getUltimoPacienteInserido();
    return $id;
}
開發者ID:joseAugustoCR,項目名稱:TCC_Servidor,代碼行數:7,代碼來源:recepcionista.php

示例4: storePatient

 /**
  * Storing new user
  * returns user details
  */
 public function storePatient($name, $email, $password, $address, $telephone)
 {
     require_once 'DB_Functions.php';
     $dbFunctions = new DB_Functions();
     $resultP = mysqli_query($this->mysqli, "INSERT INTO per_all_people_f(name, email, person_type, telephone ) VALUES('{$name}', '{$email}', 'P' , '{$telephone}');");
     // check for successful store
     if ($resultP) {
         // get user details
         $personId = mysqli_insert_id($this->mysqli);
         // last inserted id
         $uuid = uniqid('', true);
         $hash = $dbFunctions->hashSSHA($password);
         $encrypted_password = $hash["encrypted"];
         // encrypted password
         $salt = $hash["salt"];
         // salt
         $resultU = mysqli_query($this->mysqli, "INSERT INTO users(unique_id, name, email, person_id, encrypted_password, salt, created_at) VALUES('{$uuid}', '{$name}', '{$email}', '{$personId}', '{$encrypted_password}', '{$salt}', NOW())");
         $resultPatient = mysqli_query($this->mysqli, "INSERT INTO patient(person_id) VALUES('{$personId}')");
         $patientId = mysqli_insert_id($this->mysqli);
         // last inserted id
         $patientIdUpdate = mysqli_query($this->mysqli, "update per_all_people_f set patient_id = {$patientId}  where person_id = {$personId}");
         $resultAddress = mysqli_query($this->mysqli, "INSERT INTO address(house_no,person_id) VALUES('{$address}','{$personId}')");
         $result = mysqli_query($this->mysqli, "SELECT * FROM per_all_people_f WHERE person_id = {$personId}");
         if ($resultU && $resultPatient && $resultAddress && $patientIdUpdate) {
             return mysqli_fetch_array($result);
         } else {
             return FALSE;
         }
     } else {
         return false;
     }
 }
開發者ID:anuprathi321,項目名稱:erx,代碼行數:36,代碼來源:DB_Functions_Patient.php

示例5: smartpush

function smartpush($uid, $message)
{
    include "db_functions.php";
    include "gcm.php";
    $gcm = new GCM();
    $db = new DB_Functions();
    $users = $db->getAllUsers();
    if ($users != false) {
        $no_of_users = mysql_num_rows($users);
    } else {
        $no_of_users = 0;
    }
    if ($no_of_users > 0) {
        while ($row = mysql_fetch_array($users)) {
            $regId = $row['gcm_regid'];
            // $message = "สวัสดีชาวโลก";
            $registatoin_ids = array($regId);
            // $message = array("price" => $message);
            $result = $gcm->send_notification($registatoin_ids, $message);
            //echo $result;
        }
    } else {
        echo "ไม่มีข้อมูล";
    }
}
開發者ID:aclub88,項目名稱:amss,代碼行數:25,代碼來源:smartpush.php

示例6: processForm

function processForm()
{
    $db = new DB_Functions();
    $error_msg = "";
    //validate user input
    if ($_POST['currency'] == "") {
        printForm();
        echo "Invalid Currency Entered.\n";
        return;
    } else {
        if ($_POST['buyingRate'] == "") {
            printForm();
            echo "Invalid Buying Rate.\n";
            return;
        } else {
            if ($_POST['sellingRate'] == "") {
                printForm();
                echo "Invalid Selling Rate.\n";
                return;
            }
        }
    }
    //save data to table
    $result = $db->addExchangeRate($_POST['currency'], $_POST['buyingRate'], $_POST['sellingRate']);
    if (!$result == false) {
        //data was successfully saved to database
        header('Location: http://localhost/eserver/account.php');
    } else {
        $error_msg = "Data could not be saved in database.\n";
        printForm();
    }
}
開發者ID:zuozhiyu,項目名稱:BankingApp-Server,代碼行數:32,代碼來源:createNewCurrency.php

示例7: testChangeBeliebt

 public function testChangeBeliebt()
 {
     $db = new DB_Functions();
     $this->assertTrue($db->changeBeliebt(1, 1));
     $irgendneVariable = $db->getSpeisen();
     $this->assertEquals(1, $irgendneVariable[0]['beliebt'], 'Beliebtheit nicht gestiegen');
 }
開發者ID:SvenKt,項目名稱:CBR,代碼行數:7,代碼來源:DatabaseTest.php

示例8: searchDB

function searchDB($query, $extra)
{
    // Get Database connector
    include_once 'config/db_functions.php';
    $db = new DB_Functions();
    $result = $db->searchTable($query, $extra);
    //$result =$extra;
    return $result;
}
開發者ID:jur1,項目名稱:Moz-News,代碼行數:9,代碼來源:stories.php

示例9: send_notification

 /**
  * Sending Push Notification
  */
 public function send_notification($registration_ids, $message)
 {
     // include config
     require_once 'config.php';
     // Set POST variables
     $url = 'https://android.googleapis.com/gcm/send';
     $fields = array('registration_ids' => $registration_ids, 'data' => $message);
     $headers = array('Authorization: key=' . GOOGLE_API_KEY, 'Content-Type: application/json');
     // Open connection
     $ch = curl_init();
     // Set the url, number of POST vars, POST data
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_POST, true);
     curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     // Disabling SSL Certificate support temporarly
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
     // Execute post
     $result = curl_exec($ch);
     if ($result === FALSE) {
         die('Curl failed: ' . curl_error($ch));
     } else {
         $jsonres = json_decode($result);
         if (!empty($jsonres->results)) {
             require_once 'db_functions.php';
             $db = new DB_Functions();
             for ($i = 0; $i < count($jsonres->results); $i++) {
                 if (isset($jsonres->results[$i]->registration_id)) {
                     $new = $db->updateUser($registration_ids[$i], $jsonres->results[$i]->registration_id);
                 } else {
                     if (isset($jsonres->results[$i]->error)) {
                         if ($jsonres->results[$i]->error == "NotRegistered") {
                             $res = $db->deleteUser($registration_ids[$i]);
                         }
                     }
                 }
             }
             echo $result . "\n";
             $canonical_ids_count = $jsonres->canonical_ids;
             if ($canonical_ids_count) {
                 echo count($canonical_ids_count) . " registrations updated\n";
             }
         }
     }
     // Close connection
     curl_close($ch);
 }
開發者ID:MumbaiHackerspace,項目名稱:kzpa,代碼行數:51,代碼來源:GCM.php

示例10: processForm

function processForm()
{
    $db = new DB_Functions();
    $error_msg = "";
    //validate user input
    if ($_POST['ad'] == "") {
        printForm();
        echo "Invalid Adert value.\n";
        return;
    } else {
        if ($_POST['ad_url'] == "") {
            printForm();
            echo "Invalid Advert URL value.\n";
            return;
        } else {
            if ($_POST['ad_category'] == "") {
                printForm();
                echo "Invalid Advert category value.\n";
                return;
            }
        }
    }
    //save data to table
    $result = $db->addNewAdvert($_POST['ad'], $_POST['ad_url'], $_POST['ad_category']);
    if (!$result == false) {
        //data was successfully saved to database
        header('Location: http://localhost/eserver/account.php');
    } else {
        $error_msg = "Data could not be saved in database.\n";
        printForm();
    }
}
開發者ID:zuozhiyu,項目名稱:BankingApp-Server,代碼行數:32,代碼來源:createNewAd.php

示例11: reportList

function reportList()
{
    $db = new DB_Functions();
    $reportNames = $db->getAllReportList();
    if ($reportNames != false) {
        $no_of_reports = mysql_num_rows($reportNames);
    } else {
        $no_of_reports = 0;
    }
    echo '<li><a>NA</a></li>';
    if ($no_of_reports > 0) {
        while ($row = mysql_fetch_array($reportNames)) {
            echo '<li><a >' . $row["ReportName"] . '</a></li>';
        }
    } else {
        echo '<li>No Reports Added Yet!</li>';
    }
}
開發者ID:ameerhamza26,項目名稱:audit,代碼行數:18,代碼來源:reportView.php

示例12: usersList

function usersList()
{
    $db = new DB_Functions();
    $users = $db->getAllUsers();
    if ($users != false) {
        $no_of_users = mysql_num_rows($users);
    } else {
        $no_of_users = 0;
    }
    echo '<li><a>NA</a></li>';
    if ($no_of_users > 0) {
        while ($row = mysql_fetch_array($users)) {
            echo '<li><a >' . $row["Name"] . '</a></li>';
        }
    } else {
        echo '<li>No Users Registered Yet!</li>';
    }
}
開發者ID:ameerhamza26,項目名稱:audit,代碼行數:18,代碼來源:profile.php

示例13: processForm

function processForm()
{
    $db = new DB_Functions();
    //validate user input
    if ($_POST['rangeFrom'] == "") {
        printForm();
        echo "Invalid From Range.\n";
        return;
    } else {
        if ($_POST['rangeTo'] == "") {
            printForm();
            echo "Invalid Invalid Range To.\n";
            return;
        } else {
            if ($_POST['1MonthPa'] == "") {
                printForm();
                echo "Invalid 1 month pa Value.\n";
                return;
            } else {
                if ($_POST['3MonthPa'] == "") {
                    printForm();
                    echo "Invalid 3 month pa Value.\n";
                    return;
                } else {
                    if ($_POST['6MonthPa'] == "") {
                        printForm();
                        echo "Invalid 6 month pa Value.\n";
                        return;
                    } else {
                        if ($_POST['1YearPa'] == "") {
                            printForm();
                            echo "Invalid 1 Year pa Value.\n";
                            return;
                        }
                    }
                }
            }
        }
    }
    //save data to table
    $result = $db->addFixedDepositRate($_POST['rangeFrom'], $_POST['rangeTo'], $_POST['1MonthPa'], $_POST['3MonthPa'], $_POST['6MonthPa'], $_POST['1YearPa']);
    if (!$result == false) {
        //data was successfully saved to database
        header('Location: http://localhost/eserver/account.php');
    } else {
        $error_msg = "Data could not be saved in database.\n";
        printForm();
    }
}
開發者ID:zuozhiyu,項目名稱:BankingApp-Server,代碼行數:49,代碼來源:createNewFixedDeposit.php

示例14: processForm

function processForm()
{
    $db = new DB_Functions();
    $error_msg = "";
    //validate user input
    if ($_POST['adminname'] == "") {
        printForm();
        echo "Invalid Name.\n";
        return;
    } else {
        if ($_POST['idNo'] == "") {
            printForm();
            echo "Invalid IdNo.\n";
            return;
        } else {
            if ($_POST['password'] == "") {
                printForm();
                echo "Invalid Password.\n";
                return;
            } else {
                if ($_POST['password'] != $_POST['passwordConfirm']) {
                    printForm();
                    echo "Passwords do not match!\n";
                    return;
                } else {
                    if ($_POST['username'] == "") {
                        printForm();
                        echo "Invalid Username.\n";
                        return;
                    }
                }
            }
        }
    }
    //save data to table
    $result = $db->administratorSignUp($_POST['username'], md5($_POST['password']), $_POST['idNo'], $_POST['adminname']);
    if (!$result == false) {
        //data was successfully saved to database
        header('Location: http://localhost/eserver/account.php');
    } else {
        $error_msg = "Data could not be saved in database.\n";
        printForm();
    }
}
開發者ID:zuozhiyu,項目名稱:BankingApp-Server,代碼行數:44,代碼來源:createNewAdmin.php

示例15: ini_set

<?php

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!";
開發者ID:singtolee,項目名稱:PHP_END,代碼行數:31,代碼來源:updatingaddress.php


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