本文整理汇总了PHP中ORM::select方法的典型用法代码示例。如果您正苦于以下问题:PHP ORM::select方法的具体用法?PHP ORM::select怎么用?PHP ORM::select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ORM
的用法示例。
在下文中一共展示了ORM::select方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: header
}
if (isset($_SESSION['user'])) {
if ($_SESSION['user'] != "admin") {
header("Location: MyOrders.php");
}
}
if (isset($_COOKIE['user'])) {
if ($_COOKIE['user'] != "admin") {
header("Location: MyOrders.php");
}
}
require_once 'database/model.php';
$mydb = new ORM();
$mydb->setTable("users");
if (isset($_POST["id"])) {
$user = $mydb->select(array("id" => $_POST["id"]));
$row = $user->fetch_assoc();
}
?>
<nav class="navbar navbar-inverse navbar-static-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="AdminHome.php">MyCafe</a>
</div>
示例2: array
}
if (empty($_POST["category"])) {
echo "<h4 class='alert-danger'> Category is required</h4>";
$key = 1;
}
if ($key == 0) {
// image handling
if (!empty($_FILES['image']['name'])) {
$image_path = "images/products/" . $_FILES['image']['name'];
move_uploaded_file($_FILES["image"]["tmp_name"], $image_path);
$image = $_FILES['image']['name'];
} else {
$image = 'default.jpg';
}
// database insertion
$selected = $cat_db->select(array('name' => $_POST["category"]));
$category = $selected->fetch_assoc();
$product = array('name' => $_POST["product_name"], 'price' => $_POST["price"], 'category_id' => $category['id'], 'is_available' => 1, 'pic' => $image);
$where = array('id' => $_POST["id"]);
$result = $prod_db->update($where, $product);
header("Location: Products.php");
}
}
?>
<h1>Edit Product</h1>
<form method="post" action="EditProduct.php" class="form-horizontal" enctype="multipart/form-data">
<div class="form-group panel">
<label class="control-label">Product Name</label>
<input type="text" name="product_name" class="form-control" value="<?php
echo $row['name'];