本文整理汇总了PHP中Db::queryAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Db::queryAll方法的具体用法?PHP Db::queryAll怎么用?PHP Db::queryAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Db
的用法示例。
在下文中一共展示了Db::queryAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: findReplies
function findReplies($a)
{
$commentsReplies = Db::queryAll('SELECT * FROM comments_table WHERE item_id=? && reply_to=?', $_GET['item'], $a);
for ($i = 0; $i < count($commentsReplies); $i++) {
$date = date('d.m Y', strtotime($commentsReplies[$i]['comment_date']));
echo '
<li class="comment">
<figure>
<div class="image">
<img alt="" src="' . $commentsReplies[$i]['image'] . '">
</div>
</figure>
<div class="comment-wrapper">
<div class="name pull-left">' . $commentsReplies[$i]['author_name'] . '</div>
<span class="date pull-right"><span class="fa fa-calendar"></span>' . $date . '</span>
<div class="rating rating-individual" data-score="' . $commentsReplies[$i]['rating'] . '"></div>
<p>' . $commentsReplies[$i]['comment_content'] . '</p>
<a href="#" class="reply"><span class="fa fa-reply"></span>Reply</a>
<hr>
<ul class="comment-reply">';
findReplies($commentsReplies[$i]['comment_id']);
echo '</ul>
</div>
</li>
';
}
}
示例2: checkBrute
private function checkBrute($login)
{
$timeOfAttempt = date('Y-m-d H:i:s', time() - BRUTEFORCE_LOCKED_TIME);
$attempts = Db::queryAll('SELECT `login`, `timestamp` FROM `login_attempts`
WHERE `login` = ? && `timestamp` > ? && `success` = 0', [$login, $timeOfAttempt]);
if (BRUTEFORCE_NUMBER_OF_ATTEMPTS < count($attempts)) {
return true;
}
return false;
}
示例3: getMembers
public function getMembers($adminId, $lang)
{
$placesIds = $this->returnAdminPlacesIds($adminId);
$members = [];
foreach ($placesIds as $placeID) {
$tariffMembers = Db::queryAll('SELECT `id_user`,`first_name`,`last_name`,`telephone`,`active`,`email`,`tariffCZE`,`name`,`places`.`id` AS `id_of_place`
FROM `users`
JOIN `tariffs` ON `user_tariff` = `id_tariff`
JOIN `places` ON `tariffs`.`place_id` = `places`.`id`
WHERE `place_id` = ?
ORDER BY `active` DESC, `invoicing_start_date` ASC', [$placeID]);
//for equvivalent position between members
foreach ($tariffMembers as $tm) {
$members[] = $tm;
}
}
//add first payment date to each member
foreach ($members as &$m) {
$m['firstPaymentDate'] = $this->getFirstPaymentDate($m['id_user'], $lang);
$m['paymentFlag'] = $this->getPaymentFlag($m['id_user']);
}
return $members;
}
示例4: header
<?php
if (isset($_POST['sorting'])) {
$includePath = '';
include_once 'connect_db.php';
$sorting = Db::queryAll('SELECT sorting_option, sorting_option_title FROM sorting_options_table');
$querySorting = $_GET;
$querySorting['sort_by'] = $_POST['sorting'];
header('Location: index.php?' . http_build_query($querySorting));
} else {
$sorting = Db::queryAll('SELECT sorting_option, sorting_option_title FROM sorting_options_table');
}
?>
<form role="form" id="form-sorting" method="post" action="">
<div class="form-group">
<select name="sorting" id="item-sorting">
<?php
for ($i = 0; $i < count($sorting); $i++) {
?>
<?php
if (isset($_GET['sort_by'])) {
?>
<?php
if ($_GET['sort_by'] == $sorting[$i]['sorting_option']) {
?>
<option value="<?php
echo $sorting[$i]['sorting_option'];
?>
"> <?php
echo $sorting[$i]['sorting_option_title'];
?>
示例5:
<?php
$item = Db::queryAll('SELECT item_id, title, city, price, image FROM items_table ORDER BY date_created DESC LIMIT ?', $config['footer_items_number']);
$footerLinks = Db::queryAll('SELECT url, title FROM footer_links_table');
?>
<!-- Page Footer -->
<footer id="page-footer">
<div class="inner">
<section id="footer-main">
<div class="container">
<div class="row">
<div class="col-md-3 col-sm-3">
<article>
<h3>About Us</h3>
<p><?php
echo $config['about_us'];
?>
</p>
<!--<hr>-->
<!--<a href="#" class="link-arrow">Read More</a>-->
</article>
</div><!-- /.col-sm-3 -->
<div class="col-md-3 col-sm-3">
<article>
<h3>Recent Properties</h3>
<?php
for ($i = 0; $i < count($item); $i++) {
?>
<?php
if (!empty($item)) {
?>
示例6: getPaymentData
private function getPaymentData($paymentId)
{
$payment = Db::queryOne('SELECT `id_payer`,`email`,`priceCZK`,`invoice_fakturoid_number` FROM `payments`
JOIN `users` ON `users`.`id_user` = `payments`.`id_payer`
JOIN `tariffs` ON `users`.`user_tariff` = `tariffs`.`id_tariff`
WHERE `id_payment` = ?', [$paymentId]);
//add sum of all extras
$extras = Db::queryAll('SELECT `priceCZK` FROM `extras` WHERE `payment_id` = ?', [$paymentId]);
$extrasSum = 0;
foreach ($extras as $e) {
$extrasSum += $e['priceCZK'];
}
$payment['priceCZK'] += $extrasSum;
return $payment;
}
示例7: intval
<?php
require './init.php';
$set_id = intval($_GET['id']);
$rows = Db::queryAll('SELECT * FROM key_to_values WHERE set_id=?', $set_id);
if (empty($rows)) {
header('Location: ../index.php');
exit;
}
$array_to_encode = [];
foreach ($rows as $keyvaluepair) {
$array_to_encode[$keyvaluepair['key']] = json_decode($keyvaluepair['values']);
}
echo json_encode($array_to_encode);
示例8:
?>
">
<select name="district_id" id="district">
<?php
if (isset($_GET['district_id'])) {
?>
<option value="<?php
echo $_GET['district_id'];
?>
"><?php
echo Db::querySingle('SELECT district_title FROM search_districts_table WHERE district_id=?', $_GET['district_id']);
?>
</option>
<option value="">- District -</option>
<?php
$districts = Db::queryAll('SELECT * FROM search_districts_table WHERE parent=?', $_GET['city_id']);
?>
<?php
for ($i = 0; $i < count($districts); $i++) {
?>
<?php
if ($districts[$i]['district_id'] != $_GET['district_id']) {
?>
<option value="<?php
echo $districts[$i]['district_id'];
?>
"><?php
echo $districts[$i]['district_title'];
?>
</option>
<?php
示例9: urlencode
><li><?php
echo $set['set_name'];
?>
</li></a>
<?php
}
?>
</ul>
</section>
<section class="outline">
<div class="heading">
<h1>memorize the outline</h1>
</div>
<ul>
<?php
$set_names = Db::queryAll("SELECT * FROM outlines");
foreach ($set_names as $set) {
?>
<a class='set-tile' href=<?php
echo "'outline.php?id=" . urlencode($set['id']) . "'";
?>
><li><?php
echo $set['name'];
?>
</li></a>
<?php
}
?>
</ul>
</section>
<div class="subheading">
示例10:
<?php
$item = Db::queryAll('SELECT item_id, title, city, price, image FROM items_table ORDER BY date_created DESC LIMIT 3');
?>
<!-- sidebar -->
<div class="col-md-3 col-sm-3">
<section id="sidebar">
<aside id="edit-search">
<header><h3>Search Properties</h3></header>
<?php
include_once $includePath . 'views/search_form.php';
?>
</aside><!-- /#edit-search -->
<aside id="recent-properties">
<header><h3>Recent Properties</h3></header>
<?php
for ($i = 0; $i < $config['sidebar_items_number']; $i++) {
?>
<?php
if ($item) {
?>
<?php
include $includePath . 'views/single_item_small.php';
?>
<?php
}
?>
<?php
}
?>
</aside><!-- /#featured-properties -->
示例11: getLastAttempts
public function getLastAttempts($numberOfAtetmpts)
{
$attempts = Db::queryAll('SELECT `id`, `uid_key` FROM `lock_attempts` ORDER BY `timestamp` DESC LIMIT ?', [$numberOfAtetmpts]);
return $attempts;
}
示例12: getAll
public static function getAll()
{
$db = new Db();
$query = "SELECT * FROM photos";
return $db->queryAll($query);
}
示例13: getExpiredPayments
public function getExpiredPayments($toleranceDays)
{
$dbResults = Db::queryAll('SELECT `price_CZK`, `email`, `id_user` FROM `payments`
JOIN `users` ON `users`.`id_user` = `payments`.`id_payer`
WHERE `status` != (? || ?)', ['confirmed', 'received']);
$result = [];
foreach ($dbResults as $r) {
$result[] = ['id_user' => $r['id_user'], 'email' => $r['email'], 'price_CZK' => $r['price_CZK']];
}
return $result;
}
示例14: getBlankExtras
public function getBlankExtras($id_user)
{
return Db::queryAll('SELECT `id_extra`,`description`,`priceCZK` FROM `extras`
WHERE `blank_user_id` = ? AND `payment_id` IS NULL', [$id_user]);
}
示例15: elseif
for ($c = 0; $c < count($tempCountry); $c++) {
Db::query('DELETE FROM search_countries_table WHERE country_id=?', $tempCountry[$c]['country_id']);
$tempCity = Db::queryAll('SELECT * FROM search_cities_table WHERE parent=?', $tempCountry[$c]['country_id']);
for ($ct = 0; $ct < count($tempCity); $ct++) {
Db::query('DELETE FROM search_cities_table WHERE city_id=?', $tempCity[$ct]['city_id']);
$tempDistrict = Db::queryAll('SELECT * FROM search_districts_table WHERE parent=?', $tempCity[$ct]['city_id']);
for ($d = 0; $d < count($tempDistrict); $d++) {
Db::query('DELETE FROM search_districts_table WHERE district_id=?', $tempDistrict[$d]['district_id']);
}
}
}
} elseif ($_POST['itemType'] == 'country') {
Db::query('DELETE FROM search_countries_table WHERE country_id=?', $_POST['id']);
$tempCity = Db::queryAll('SELECT * FROM search_cities_table WHERE parent=?', $_POST['id']);
for ($ct = 0; $ct < count($tempCity); $ct++) {
Db::query('DELETE FROM search_cities_table WHERE city_id=?', $tempCity[$ct]['city_id']);
$tempDistrict = Db::queryAll('SELECT * FROM search_districts_table WHERE parent=?', $tempCity[$ct]['city_id']);
for ($d = 0; $d < count($tempDistrict); $d++) {
Db::query('DELETE FROM search_districts_table WHERE district_id=?', $tempDistrict[$d]['district_id']);
}
}
} elseif ($_POST['itemType'] == 'city') {
Db::query('DELETE FROM search_cities_table WHERE city_id=?', $_POST['id']);
$tempDistrict = Db::queryAll('SELECT * FROM search_districts_table WHERE parent=?', $_POST['id']);
for ($d = 0; $d < count($tempDistrict); $d++) {
Db::query('DELETE FROM search_districts_table WHERE district_id=?', $tempDistrict[$d]['district_id']);
}
} elseif ($_POST['itemType'] == 'district') {
Db::query('DELETE FROM search_districts_table WHERE district_id=?', $_POST['id']);
}
}