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


PHP DbConnect::getDb方法代码示例

本文整理汇总了PHP中DbConnect::getDb方法的典型用法代码示例。如果您正苦于以下问题:PHP DbConnect::getDb方法的具体用法?PHP DbConnect::getDb怎么用?PHP DbConnect::getDb使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DbConnect的用法示例。


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

示例1: DbConnect

<?php

include_once 'db.php';
$db = new DbConnect();
$finalResult = array();
//$cust_id = '2';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $cust_id = $_POST['cust_id'];
    $result = mysqli_query($db->getDb(), "select order_id, totalprice, time, status FROM order_t WHERE cust_id = '{$cust_id}' ");
    $row_cnt = mysqli_num_rows($result);
    //echo $row_cnt;
    $order_id_1 = array();
    while ($order_id_1 = mysqli_fetch_array($result)) {
        /*echo $order_id_1["order_id"];
          echo $order_id_1["totalprice"];
          echo $order_id_1["time"];
          echo $order_id_1["status"];*/
        $temp = $order_id_1["order_id"];
        //echo "temp";
        //echo $temp;
        $result1 = mysqli_query($db->getDb(), "select order_id, item_id, itemname, quantity from Item NATURAL JOIN (select order_id, item_id, quantity, totalprice, cust_id, status,time from order_t NATURAL JOIN orderDetail where order_id = '{$temp}') as X ");
        $row_cnt = mysqli_num_rows($result1);
        //echo "row count";
        //echo $row_cnt;
        $response["order_id"] = $order_id_1["order_id"];
        $response["totalprice"] = $order_id_1["totalprice"];
        $response["time"] = $order_id_1["time"];
        $response["status"] = $order_id_1["status"];
        $response["details"] = array();
        while ($row = mysqli_fetch_array($result1)) {
            // temp user array
开发者ID:kshitijSharma2014,项目名称:orderPlaceApp,代码行数:31,代码来源:orderedItemsUser1.php

示例2: DbConnect

<?php

include_once 'db.php';
$db = new DbConnect();
$response = array();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $order_id = $_POST['order_id'];
    $result = mysqli_query($db->getDb(), "UPDATE order_t SET status =1 where order_id = '{$order_id}'");
    $response["success"] = 1;
    echo json_encode($response);
} else {
    $response["success"] = 0;
    $response["message"] = "No orders found";
    // echo no users JSON
    echo json_encode($response);
}
开发者ID:kshitijSharma2014,项目名称:orderPlaceApp,代码行数:16,代码来源:orderApprove.php

示例3: WHERE

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $name = $_POST['name'];
    $phnum = $_POST['phnum'];
    $address = $_POST['address'];
    $email = $_POST['email'];
    $passwd = $_POST['passwd'];
    //$name = 'kshitij sharma';
    //$phnum = '9662035550';
    //$address = 'qwerty';
    //$email = 'ksh1@gmail.com';
    //$passwd = 'qwerty';
    if ($name == '' || $phnum == '' || $address == '' || $email == '' || $passwd == '') {
        //echo 'please fill all values';
    } else {
        $sql = "SELECT * FROM customer WHERE (email='{$email}' || phnum = '{$phnum}')";
        $check = mysqli_fetch_array(mysqli_query($db->getDb(), $sql));
        if (isset($check)) {
            //echo 'username or email already exist';
        } else {
            $sql = "INSERT INTO customer (name,phnum,address,email,passwd,active,isAdmin,time) VALUES('{$name}','{$phnum}','{$address}','{$email}','{$passwd}','1','0',NOW())";
            if (mysqli_query($db->getDb(), $sql)) {
                //echo 'successfully registered';
                $response["success"] = 1;
                echo json_encode($response);
            } else {
                //echo 'oops! Please try again!';
                $response["success"] = 0;
                $response["message"] = "No products found";
                echo json_encode($response);
            }
        }
开发者ID:kshitijSharma2014,项目名称:orderPlaceApp,代码行数:31,代码来源:register.php

示例4: date

    //echo $product["quantity"];
    //echo "{$manag->Item_id}\n";
    //echo "{$manag->quantity}\n";
}
//echo "price";
$totalprice = "{$manage->totalprice}";
//echo "cust_id";
$cust_id = "{$manage->cust_id}";
//$cust_id = '9';
//$totalprice = '100'
//$item_id = '6';
//$quantity = '2';
$time = date("Y-m-d H:i:s");
//echo "$time";
$query = "insert into order_t (cust_id, time, totalprice, status) values ('{$cust_id}', '{$time}', '{$totalprice}', '0' ) ";
$inserted = mysqli_query($db->getDb(), $query);
//echo "first query executed";
$query = "select order_id from order_t where (time = '{$time}' and cust_id = '{$cust_id}' and totalprice = {$totalprice}) ";
$result1 = mysqli_query($db->getDb(), $query);
//$order_id_1[] = mysqli_fetch_array($order_id_temp);
//echo "order_id from query \n\n\n";
$num = mysqli_num_rows($result1);
//echo "number";
//echo "$num";
//while($order_id_1[] = mysqli_fetch_array($order_id_temp)){
$order_id_1 = mysqli_fetch_array($result1);
//should not contain all rows
//echo "order id.....";
print_r($order_id_1['order_id']);
//echo sizeof($order_id_1);
$oID = 0;
开发者ID:kshitijSharma2014,项目名称:orderPlaceApp,代码行数:31,代码来源:placeOrder.php

示例5: array

include_once 'db.php';
$response = array();
$db = new DbConnect();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    //Getting values
    $username = $_POST['email'];
    $password = $_POST['password'];
    //$username = 'ksh@gmail.com';
    //$password = 'a';
    //echo "hi";
    //Creating sql query
    $sql = "SELECT * FROM customer WHERE (email='{$username}' || phnum = '{$username}') AND passwd='{$password}'";
    echo "hello";
    //importing dbConnect.php script
    //executing query
    $result = mysqli_query($db->getDb(), $sql);
    //fetching result
    $check = mysqli_fetch_array($result);
    //echo $check;
    //if we got some result
    if (isset($check)) {
        //displaying success
        //echo "success";
        $response["success"] = 1;
        echo json_encode($response);
    } else {
        //displaying failure
        //echo "failure";
        $response["success"] = 0;
        $response["message"] = "No products found";
        echo json_encode($response);
开发者ID:kshitijSharma2014,项目名称:orderPlaceApp,代码行数:31,代码来源:login.php

示例6: DbConnect

<?php

include_once 'db.php';
$db = new DbConnect();
$finalResult = array();
//$cust_id = '2';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $params = $_POST['params'];
    if ($params == 'all') {
        # code...
        $result = mysqli_query($db->getDb(), "select order_id, totalprice, time, status FROM order_t");
    } else {
        if ($params == 'placed') {
            $result = mysqli_query($db->getDb(), "select order_id, totalprice, time, status FROM order_t where status = '0'");
        } else {
            if ($params == 'approved') {
                $result = mysqli_query($db->getDb(), "select order_id, totalprice, time, status FROM order_t where status = '1'");
            } else {
                if ($params == 'delivered') {
                    $result = mysqli_query($db->getDb(), "select order_id, totalprice, time, status FROM order_t where status = '2'");
                } else {
                    $finalResult["success"] = 0;
                    $finalResult["message"] = "no params!";
                    echo json_encode($response);
                }
            }
        }
    }
    $result = mysqli_query($db->getDb(), "select order_id, totalprice, time, status FROM order_t");
    $row_cnt = mysqli_num_rows($result);
    //echo $row_cnt;
开发者ID:kshitijSharma2014,项目名称:orderPlaceApp,代码行数:31,代码来源:orderedItemsAdmin1.php

示例7: DbConnect

<?php

//echo "ksh";
include_once 'db.php';
$db = new DbConnect();
$response = array();
// get a product from products table
$result = mysqli_query($db->getDb(), "SELECT Item_id, itemname, price, picurl FROM Item where isAvailable = '1' ");
$row_cnt = mysqli_num_rows($result);
//echo $row_cnt;
if (mysqli_num_rows($result) > 0) {
    // looping through all results
    // products node
    $response["products"] = array();
    while ($row = mysqli_fetch_array($result)) {
        // temp user array
        $product = array();
        $product["Item_id"] = $row["Item_id"];
        $product["itemname"] = $row["itemname"];
        $product["price"] = $row["price"];
        $product["picurl"] = $row["picurl"];
        // push single product into final response array
        array_push($response["products"], $product);
    }
    // success
    $response["success"] = 1;
    // echoing JSON response
    echo json_encode($response);
} else {
    // no products found
    $response["success"] = 0;
开发者ID:kshitijSharma2014,项目名称:orderPlaceApp,代码行数:31,代码来源:itemlist.php


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