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


PHP dbi函数代码示例

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


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

示例1: get_processing_orders

    public static function get_processing_orders($Chefs_Tasting = '0', $date = NULL, $trans_id_null = true) {
        if ($date === NULL || !$date) {
            $date = 'DATE_ADD(CURDATE(), INTERVAL 3 DAY)';
        } else {
            $date = "'$date'";
        }
        if ($trans_id_null) {
            $additional = 'AND TransactionNumber IS NULL';
        } else {
            $additional = "AND (TransactionNumber IS NOT NULL OR Chefs_Tasting = '1')";
            //$additional = '';
        }
        //@golive change date - " . Gadget::$date_do->format(DATE_FORMAT_MYSQL) . "
        /* Removed on Feb 17, 2014 by Steve Kleeman
         * Reason: Member wants it to show all orders.
         *
          $orders = dbi()->q_all("SELECT OrderID, DeliveryDate
          FROM Orders
          JOIN OrderDetails USING (OrderID)
          WHERE DeliveryDate = $date
          $additional
          GROUP BY OrderID
          HAVING SUM(IF(Chefs_Tasting = '$Chefs_Tasting', 1, 0)) >= 1
          ORDER BY Sequence ASC"); */

        $orders = dbi()->q_all("SELECT OrderID, DeliveryDate
                                FROM Orders
                                    JOIN OrderDetails USING (OrderID)
                                WHERE DeliveryDate = $date
                                GROUP BY OrderID
                                HAVING SUM(IF(Chefs_Tasting = '$Chefs_Tasting', 1, 0)) >= 1
                                ORDER BY Sequence ASC");
        return new Order_List($orders, $Chefs_Tasting);
    }
开发者ID:elliecm,项目名称:MadisonandRayne,代码行数:34,代码来源:order_list.class.php

示例2: funky_shutter

function funky_shutter(){
    global $ajax_status;
    global $ajax_array;
    if($ajax_status != 'success'){
        $ajax_status = 'error';
    }
    $out = $ajax_array;
    $out['status'] = $ajax_status;
    $out['html'] = ob_get_clean();
    $out['queries'] = dbi()->query_count;
    $out['query_time'] = dbi()->query_time;
    
    $suffixes = array('', 'KiB', 'MiB');
    $suf = 0;
    $out['memory'] = memory_get_peak_usage();
    while($out['memory'] > 10240){
        $out['memory'] /= 1024;
        $suf++;
    }
    $out['memory'] = round($out['memory'], 2) . ' ' . $suffixes[$suf];
    
    ob_clean();
    ob_end_clean();
    
    echo json_encode($out);
}
开发者ID:elliecm,项目名称:MadisonandRayne,代码行数:26,代码来源:ajax.inc.php

示例3: get_from_alias

 /**
  * gets information for a page based on its alias
  *
  * @param   String  $alias  alias of the page, no leading /
  * @return  Page
  */
 public static function get_from_alias($alias){
     $row_page = dbi()->q_1("SELECT * FROM WebPages WHERE Alias = '$alias'");
     if($row_page){
         return new Page($row_page);
     }else{
         return false;
     }
 }
开发者ID:elliecm,项目名称:MadisonandRayne,代码行数:14,代码来源:page.class.php

示例4: get_from_id

    public static function get_from_id($ItemID){ // singleton
        $ItemID = (int) $ItemID;
        if(isset(self::$_meals[$ItemID])){
            return self::$_meals[$ItemID];
        }
        $result = dbi()->q_1("SELECT * FROM Items i JOIN Menus m ON i.MenuID = m.MenuID WHERE i.ItemID = '$ItemID' ORDER BY m.Sequence ASC");

        $meal = new Meal($result);
        self::$_meals[$ItemID] = &$meal;
        return $meal;
    }
开发者ID:elliecm,项目名称:MadisonandRayne,代码行数:11,代码来源:meal.class.php

示例5: get_from_id

 public static function get_from_id($ItemID)
 {
     // singleton
     $ItemID = (int) $ItemID;
     if (isset(self::$_meals[$ItemID])) {
         return self::$_meals[$ItemID];
     }
     $result = dbi()->q_1("SELECT * FROM Items WHERE ItemID = '{$ItemID}'");
     $meal = new Meal($result);
     self::$_meals[$ItemID] =& $meal;
     return $meal;
 }
开发者ID:elliecm,项目名称:MadisonandRayne,代码行数:12,代码来源:meal.class.php

示例6: add_delivery_fee

 public function add_delivery_fee($userzip) {
     $zip = dbi()->q_1("SELECT * FROM ZipCode WHERE ZipCode = '{$userzip}'");
     if (!empty($zip) && $zip->Delivery !== '0.00') {
         $this->Amounts->DeliveryFee = new Amount($zip->Delivery);
     } else {
         $this->Amounts->DeliveryFee = new Amount(0);
     }
 }
开发者ID:elliecm,项目名称:MadisonandRayne,代码行数:8,代码来源:order.class.php

示例7: array

                                    'veg' => array()
                        );

                        // Loop over unique counts
                        foreach ($unique_counts as $k => $v) {
                            echo "<th>{$k}x</th>";

                            $reg_count_total = dbi()->q_1(" SELECT SUM(Count) as t
                                                            FROM KitchenReport1
                                                            WHERE ItemID = {$order->ItemID}
                                                                AND Count = {$k}
                                                                AND ItemName NOT LIKE '%- vegetarian%'")->t;

                            $veg_reg_unique_totals->reg[$k] = $reg_count_total;

                            $veg_count_total = dbi()->q_1(" SELECT SUM(Count) as t
                                                            FROM KitchenReport1
                                                            WHERE ItemID = {$order->ItemID}
                                                                AND Count = {$k}
                                                                AND ItemName LIKE '%- vegetarian%'")->t;

                            $veg_reg_unique_totals->veg[$k] = $veg_count_total;
                        }
                        ?>
                        <th>Totals</th>
                    </tr>
                    <?php
                    foreach ($ingredients as $ingredient) {
                        echo "<tr>";
                        echo "<td>{$ingredient->Letter_Code}</td>";
                        echo "<td>{$ingredient->IngredientName}</td>";
开发者ID:elliecm,项目名称:MadisonandRayne,代码行数:31,代码来源:meal_assembly_report-sydcon.php

示例8: header

// Always modified
header("Cache-Control: private, no-store, no-cache, must-revalidate");
// HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
// HTTP/1.0
include "header.php";
require_once '../includes/global.inc.php';
// No id was passed so no customer can be edited
if (!isset($_REQUEST['id']) || empty($_REQUEST['id'])) {
    header("Location: Customerslist.php");
    die;
}
// They've hit submit to reset the password
if (isset($_REQUEST['reset_pass'])) {
    $updated = dbi()->update('Customers', array('Password' => Access::create_hash($_REQUEST['new_pass'], 'strong')), 'CustomerID = ' . $_REQUEST['id']);
    if (!$updated) {
        $message = "There was an error updating the customer\\'s password";
    } else {
        $message = "Successfully updated the customer\\'s password";
    }
    echo "<script>alert('" . $message . "'); window.location = 'Customerslist.php';</script>";
}
?>

<link rel="stylesheet" type="text/css" media="all" href="calendar/calendar-win2k-1.css" title="win2k-1">
<script type="text/javascript" src="calendar/calendar.js"></script>
<script type="text/javascript" src="calendar/lang/calendar-en.js"></script>
<script type="text/javascript" src="calendar/calendar-setup.js"></script>
<script type="text/javascript" src="../js/jquery-1.9.1.min.js"></script>
<script language="JavaScript" type="text/javascript">
开发者ID:elliecm,项目名称:MadisonandRayne,代码行数:31,代码来源:reset_password.php

示例9: check_password

 public static function check_password($Password, $CustomerID) {
     if ($row = dbi()->q_1("SELECT Password FROM Customers WHERE CustomerID = '$CustomerID'")) {
         return crypt($Password, $row->Password) == $row->Password;
     }
     return false;
 }
开发者ID:elliecm,项目名称:MadisonandRayne,代码行数:6,代码来源:access.class.php

示例10: elseif

                    </tr>
                </table>
            </form>
        </div>
        <?php 
        require 'footer.php';
        die;
    } else {
        Gadget::redirect('index');
        die;
    }
} elseif (isset($_REQUEST['submit_new_pass'])) {
    // Insert new password and set expires to 0
    $request = dbi()->q_1("SELECT * FROM password_reset_requests WHERE token_id = '" . $_SESSION['token_id'] . "'");
    dbi()->update('Customers', array('Password' => Access::create_hash($_REQUEST['new_pass'], 'strong')), 'CustomerID = ' . $request->CustomerID);
    dbi()->update('password_reset_requests', array('expires' => '0000-00-00 00:00:00'), 'token_id = \'' . $_SESSION['token_id'] . '\'');
    unset($_SESSION['token_id']);
    Gadget::add_message('Your password has been reset!');
    Gadget::redirect('login');
    die;
}
require 'header.php';
?>
<div class="content-padding">
    <form name="forgot-form" class="user-form" id="forgot-form" action="forgot" method="post">
        <table>
            <tr>
                <td>
                    <label for="forgot-email">email:</label>
                </td>
                <td>
开发者ID:elliecm,项目名称:MadisonandRayne,代码行数:31,代码来源:forgot.php

示例11: IF

<?php
require '../includes/global.inc.php';
//debug(1, 1, 1);
if (!$_SESSION['madison_status_UserName']) {
    Gadget::redirect('/admin');
}
$result = $dbi->q_all("
    SELECT DeliveryDate, ItemName, ItemID, Allergies, Letter_Code, IngredientName, ItemIngredients.Amount, `Count`, FirstName, LastName,
        Comments, CustomerID, kitchen_note, IngredientID, Type, IF((TransactionNumber IS NOT NULL OR Chefs_Tasting = '1'), '1', '0') AS TransactionStatus
    FROM KitchenReport1
        JOIN ItemIngredients USING (ItemID)
        JOIN Ingredients USING (IngredientID)
        LEFT JOIN Customers USING (CustomerID)
    GROUP BY ItemName, Customers.CustomerID, IngredientID, Letter_Code
    ORDER BY ItemName, Customers.CustomerID, Letter_Code");
$meals = array();
foreach ($result as $row) {
    $item                                                      = &$meals[htmlspecialchars($row->ItemName)];
    $item->Ingredients[$row->IngredientID . $row->Letter_Code] = (object) array(
                'IngredientName' => htmlspecialchars($row->IngredientName),
                'Amount'         => $row->Amount,
                'Type'           => $row->Type,
                'Letter_Code'    => htmlspecialchars($row->Letter_Code),
    );
    $item->Customers[$row->CustomerID]                         = (object) array(
                'Allergies'         => htmlspecialchars($row->Allergies),
                'ItemName'          => $row->ItemName,
                'Count'             => $row->Count,
                'Name'              => htmlspecialchars($row->FirstName . ' ' . $row->LastName),
                'Comments'          => htmlspecialchars($row->Comments),
开发者ID:elliecm,项目名称:MadisonandRayne,代码行数:30,代码来源:meal_assembly_report-sydcon.php

示例12: date

        </table>

        <?php
// If the user has ordered for last week or next, display (if there is one) link to recipe card for that item
        $today      = date('Y-m-d');
        $yesterday  = date('Y-m-d', strtotime('-1 day'));
        $last_week  = date('Y-m-d', strtotime('-1 week'));
        $next_week  = date('Y-m-d', strtotime('+1 week'));
        $next_cards = dbi()->q_all("SELECT Items.ItemName, Items.PDF
                                    FROM Orders
                                        JOIN OrderDetails USING(OrderID)
                                        JOIN Items USING(ItemID)
                                    WHERE Orders.CustomerID = " . $_SESSION['CustomerID'] . "
                                        AND Orders.DeliveryDate BETWEEN '" . $today . "' AND '" . $next_week . "'
                                    GROUP BY Items.ItemID");
        $last_cards = dbi()->q_all("SELECT Items.ItemName, Items.PDF
                                    FROM Orders
                                        JOIN OrderDetails USING(OrderID)
                                        JOIN Items USING(ItemID)
                                    WHERE Orders.CustomerID = " . $_SESSION['CustomerID'] . "
                                        AND Orders.DeliveryDate BETWEEN '" . $last_week . "' AND '" . $yesterday . "'
                                    GROUP BY Items.ItemID");
        if (count($next_cards) > 0) {
            echo '<h2>Next Week\'s Recipe Card(s)</h2>';
            foreach ($next_cards as $next_card) {
                if (!empty($next_card->PDF) && !is_null($next_card)) {
                    echo '<a href="recipes/' . $next_card->PDF . '" target="_blank">' . $next_card->ItemName . '</a><br />';
                } else {
                    echo 'No recipe card yet for ' . $next_card->ItemName;
                }
            }
开发者ID:elliecm,项目名称:MadisonandRayne,代码行数:31,代码来源:myorder-sydcon.php

示例13: str_replace

$skip_session = true;

require str_replace('/system', '', dirname(__FILE__)) . '/includes/global.inc.php';

debug(1, 1, 0);
$date = date(DATE_FORMAT_MYSQL, strtotime('next Tuesday'));
// For only chef tasting
/*$rows   = dbi()->q_all("SELECT OrderID, DeliveryDate
                        FROM Orders
                            JOIN OrderDetails USING (OrderID)
                        WHERE DeliveryDate = '$date'
                            AND Chefs_Tasting = '1'
                        GROUP BY OrderID");*/

// For all orders
$rows   = dbi()->q_all("SELECT OrderID, DeliveryDate
                        FROM Orders
                            JOIN OrderDetails USING (OrderID)
                        WHERE DeliveryDate = '$date'
                        GROUP BY OrderID");
$orders = new Order_List($rows);

switch($date){
    case '2013-12-24':
        $date = '2013-12-23';
        break;
    case '2013-12-31':
        $date = '2013-12-30';
        break;
}
开发者ID:elliecm,项目名称:MadisonandRayne,代码行数:30,代码来源:reminder_emails.php

示例14: can_be_used

    public function can_be_used($CustomerID, $table, $debug = 0){
        $CustomerID = (int) $CustomerID;
        $table = dbi()->escape($table);

        if(!$CustomerID){ // new customers can use any promo code
            return true;
        }

        $date = Gadget::$date_do->format(DATE_FORMAT_MYSQL);

        if($table === 'Orders' || $table === 'Subscriptions' || $table === 'GiftCertificates') {
            $table = 'Orders';
            $table2 = 'Subscriptions';
            $table3 = 'GiftCertificates';
        } else {
            $table2 = 'Orders';
            $table3 = 'GiftCertificates';
        }

        if($this->One_Time_Only){
            if(dbi()->q_n("SELECT PromoCodeID FROM $table WHERE CustomerID = '$CustomerID' AND DeliveryDate <= '$date' AND PromoCodeID = '$this->PromoCodeID'
                            UNION
                            SELECT PromoCodeID FROM $table2 WHERE CustomerID = '$CustomerID' AND DeliveryDate < '$date' AND PromoCodeID = '$this->PromoCodeID'
                            UNION
                            SELECT PromoCodeID FROM $table3 WHERE CustomerID = '$CustomerID' AND PromoCodeID = '$this->PromoCodeID'")){ // already in use on another order
                return false;
            }
        }

        if($this->New_Customer_Only){
            if ($debug == 1){
                ri("SELECT PromoCodeID FROM $table WHERE CustomerID = '$CustomerID' AND DeliveryDate <= '$date'
                    UNION
                    SELECT PromoCodeID FROM $table2 WHERE CustomerID = '$CustomerID' AND DeliveryDate < '$date'
                    UNION
                    SELECT PromoCodeID FROM $table3 WHERE CustomerID = '$CustomerID'");
            }
            if(dbi()->q_n("SELECT PromoCodeID FROM $table WHERE CustomerID = '$CustomerID' AND DeliveryDate <= '$date'
                            UNION
                            SELECT PromoCodeID FROM $table2 WHERE CustomerID = '$CustomerID' AND DeliveryDate < '$date'
                            UNION
                            SELECT PromoCodeID FROM $table3 WHERE CustomerID = '$CustomerID'")){ // not this customer's first order
                return false;
            }
        }
        return true;
    }
开发者ID:elliecm,项目名称:MadisonandRayne,代码行数:47,代码来源:promocode.class.php

示例15: date

<div id="content-header">
    <div class="content-header-left">
        <div style="margin-top:40px;">
            <span class="header-text">order by:</span><span class="date"><?php echo $_date_ob->format('l F j'); ?></span>
        </div>
        <div>
            <span class="header-text">delivered on:</span><span class="date"><?php echo $_date_do->format('l F j'); ?></span>
        </div>
        <div class="title">
            <a href="/menu" style="color:#86C241;">weekday menu</a>
        </div>
    </div>
    <?php
    if (dbi()->q_1("SELECT * FROM Menus WHERE MenuID = '3' OR MenuID = '10'")->Active === '1') {
        $now = date('Y-m-d');
        $holiday_dates = dbi()->q_1("SELECT * FROM HolidayDate WHERE HolidayDeliverOn >= {$now} ORDER BY HolidayOrderBy ASC");

        if (empty($holiday_dates)) {
            $holiday_display = 'display: none;';
        } else {
            $holiday_display = '';
            $holiday_order_by = date_parse($holiday_dates->HolidayOrderBy);
            $holiday_deliver_on = date_parse($holiday_dates->HolidayDeliverOn);

            $_date_ob->setDate($holiday_order_by['year'], $holiday_order_by['month'], $holiday_order_by['day']);
            $_date_do->setDate($holiday_deliver_on['year'], $holiday_deliver_on['month'], $holiday_deliver_on['day']);
        }
        ?>
        <div class="content-header-left" style="<?php echo $holiday_display; ?>">
            <div style="margin-top:40px;">
                <span class="header-text">order by:</span><span class="date"><?php echo $_date_ob->format('l F j'); ?></span>
开发者ID:elliecm,项目名称:MadisonandRayne,代码行数:31,代码来源:menu-sydcon.php


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