本文整理汇总了PHP中ORM::select_all方法的典型用法代码示例。如果您正苦于以下问题:PHP ORM::select_all方法的具体用法?PHP ORM::select_all怎么用?PHP ORM::select_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ORM
的用法示例。
在下文中一共展示了ORM::select_all方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ORM
<form action="Logout.php" method="post" >
<input type="hidden" name="ss" value="any">
<button type="submit" class="add-user btn btn-default logout">Logout</button>
</form>
</li>
</ul>
</div>
</div>
</nav>
<div class="container" id="wrapper">
<?php
require_once 'database/model.php';
$cat_db = new ORM();
$cat_db->setTable("categories");
$categories = $cat_db->select_all();
if (isset($_POST["product_name"])) {
$key = 0;
if (empty($_POST["product_name"])) {
echo "<h4 class='alert-danger'> Product name is required</h4>";
$key = 1;
}
if (empty($_POST["price"])) {
echo "<h4 class='alert-danger'> Price is required</h4>";
$key = 1;
}
if (empty($_POST["category"])) {
echo "<h4 class='alert-danger'> Category is required</h4>";
$key = 1;
}
if ($key == 0) {
示例2: ORM
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="css/style.css" charset="utf-8">
<link rel="icon" href="images/favicon.ico" type="image/gif" sizes="32x32">
<script src="js/jquery-2.2.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<?php
session_start();
if ($_POST) {
require_once 'database/model.php';
$mydb = new ORM();
$mydb->setTable("users");
$users = $mydb->select_all();
if (!empty($_POST["keep_logged"])) {
while ($row = $users->fetch_assoc()) {
if ($_POST['email'] == $row["email"] && hash("md5", $_POST['password']) == $row["password"] && $row["is_admin"]) {
setcookie('user', 'admin', time() + 86400 * 30);
setcookie('user_id', $row["id"], time() + 86400 * 30);
header("Location: AdminHome.php");
} elseif ($_POST['email'] == $row["email"] && hash("md5", $_POST['password']) == $row["password"]) {
setcookie('user', $row["name"], time() + 86400 * 30);
setcookie('user_id', $row["id"], time() + 86400 * 30);
setcookie('user_pic', $row["pic"], time() + 86400 * 30);
header("Location: UserOrder.php");
}
}
} elseif (empty($_POST["keep_logged"])) {
while ($row = $users->fetch_assoc()) {
示例3: ORM
}
}
if (isset($_COOKIE['user'])) {
if ($_COOKIE['user'] != "admin") {
echo "You have no access to this page!";
exit;
}
}
require_once 'database/model.php';
$mydb = new ORM();
$mydb->setTable("products");
if ($_POST) {
$where = array('id' => $_POST['id']);
$mydb->delete($where);
}
$products = $mydb->select_all();
?>
<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>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">