本文整理汇总了PHP中DatabaseHandler::GetAll方法的典型用法代码示例。如果您正苦于以下问题:PHP DatabaseHandler::GetAll方法的具体用法?PHP DatabaseHandler::GetAll怎么用?PHP DatabaseHandler::GetAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DatabaseHandler
的用法示例。
在下文中一共展示了DatabaseHandler::GetAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetDepartments
public static function GetDepartments()
{
// Составляем SQL-запрос
$sql = 'CALL catalog_get_departments_list()';
// Выполняем запрос и получаем результаты
return DatabaseHandler::GetAll($sql);
}
示例2: getTeacherByid
function getTeacherByid($teacherid)
{
$sql = "SELECT * FROM teacher WHERE ID = :teacherid";
$params = array(':teacherid' => $teacherid);
$result = DatabaseHandler::GetAll($sql, $params);
return $result[0]['Name'];
}
示例3: getAllTag
public function getAllTag()
{
$sql = 'SELECT $this->table_name.*
FROM $this->table_name
ORDER BY pubdate DESC
';
$arr = DatabaseHandler::GetAll($sql);
return $arr;
}
示例4: adminauthenticate
function adminauthenticate($username, $password)
{
$passwordcrypt = ENCRYPT . $password;
$passwordcrypt = SHA1($passwordcrypt);
$sql = "SELECT * FROM admin_usr WHERE username = :username AND password = :password AND isactive = 1 AND isdeleted = 0";
$params = array(':username' => $username, ':password' => $passwordcrypt);
$result = DatabaseHandler::GetAll($sql, $params);
if (count($result) > 0) {
return 1;
}
return 0;
}
示例5: isRegForEvent
function isRegForEvent($username, $event_id)
{
$acc = getAccountbyname($username);
$user_id = $acc[0]['id'];
$sql = "SELECT * FROM registrations WHERE user_id = :user_id AND event_id = :event_id AND isdeleted = 0";
$params = array(':user_id' => $user_id, ':event_id' => $event_id);
$result = DatabaseHandler::GetAll($sql, $params);
if (count($result) > 0) {
return 1;
}
return 0;
}
示例6: GetPLStatament
public static function GetPLStatament($date, $period)
{
$ledgers = Ledger::GetPLLedgers();
$today = date('d/m/Y');
if ($date) {
if ($date == $today) {
foreach ($ledgers as &$ledger) {
$ledger->amount = $ledger->balance->amount;
}
return $ledgers;
} else {
$d1 = explode('/', $date);
$stamp = $d1[2] . $d1[0] . $d1[1] . '000000' + 0;
foreach ($ledgers as &$ledger) {
try {
$sql = 'SELECT * FROM general_ledger_entries WHERE ledger_id = ' . $ledger->id . ' AND stamp <= ' . $stamp . ' ORDER BY stamp DESC LIMIT 0,1';
$res = DatabaseHandler::GetRow($sql);
if ($res) {
$amount = $res['ledger_bal'];
} else {
$amount = 0;
}
$ledger->amount = $amount;
} catch (Exception $e) {
}
}
return $ledgers;
}
} else {
$split = explode(' - ', $period);
$d1 = explode('/', $split[0]);
$d2 = explode('/', $split[1]);
$lower = $d1[2] . $d1[1] . $d1[0] . '000000' + 0;
$upper = $d2[2] . $d2[1] . $d2[0] . '999999' + 0;
$sql = 'SELECT * FROM general_ledger_entries WHERE account_no = ' . intval($cid) . ' AND stamp BETWEEN ' . $lower . ' AND ' . $upper . ' ORDER BY id ASC';
foreach ($ledgers as &$ledger) {
try {
$sql = 'SELECT * FROM general_ledger_entries WHERE ledger_id = ' . $ledger->id . ' AND stamp BETWEEN ' . $lower . ' AND ' . $upper . ' ORDER BY stamp ASC';
$res = DatabaseHandler::GetAll($sql);
$amount = 0.0;
foreach ($res as $tx) {
$amount += $tx['amount'];
}
$ledger->amount = $amount;
} catch (Exception $e) {
}
}
return $ledgers;
}
}
示例7: checkBox
public static function checkBox($table, $idField, $titleField, $elementName, $whereClause = '', $cssClass = '', $onClick = '')
{
DatabaseHandler::Execute("SET NAMES UTF8;");
$sql = "SELECT * FROM {$table} {$whereClause}";
$records = DatabaseHandler::GetAll($sql);
DatabaseHandler::Close();
$checkBox = '';
foreach ($records as $item) {
$id = $item[$idField];
$text = $item[$titleField];
$checkBox .= "<label class='{$cssClass}'><input type='checkbox' name='{$elementName}' id='{$elementName}{$id}' value='{$id}' />{$text}</label>";
}
return $checkBox;
}
示例8: GetProductsInCategory
public static function GetProductsInCategory($categoryId, $pageNo, &$rHowManyPages)
{
// Query that returns the number of products in the category
$sql = 'CALL catalog_count_products_in_category(:category_id)';
// Build the parameters array
$params = array(':category_id' => $categoryId);
// Calculate the number of pages required to display the products
$rHowManyPages = Catalog::HowManyPages($sql, $params);
// Calculate the start item
$start_item = ($pageNo - 1) * PRODUCTS_PER_PAGE;
// Retrieve the list of products
$sql = 'CALL catalog_get_products_in_category(
:category_id, :short_product_description_length,
:products_per_page, :start_item)';
// Build the parameters array
$params = array(':category_id' => $categoryId, ':short_product_description_length' => SHORT_PRODUCT_DESCRIPTION_LENGTH, ':products_per_page' => PRODUCTS_PER_PAGE, ':start_item' => $start_item);
// Execute the query and return the results
return DatabaseHandler::GetAll($sql, $params);
}
示例9: getCategory
function getCategory($id)
{
$sql = "SELECT * FROM event_categories WHERE id = :id AND isdeleted = 0";
$params = array(':id' => $id);
$result = DatabaseHandler::GetAll($sql, $params);
return $result;
}
示例10: authors_SelectAll
public static function authors_SelectAll()
{
$sql = 'CALL `sp_authors_SelectAll`()';
DatabaseHandler::Close();
return DatabaseHandler::GetAll($sql);
}
示例11: permissions_SelectAll
public static function permissions_SelectAll()
{
$sql = 'CALL `sp_permissions_SelectAll`()';
DatabaseHandler::Close();
return DatabaseHandler::GetAll($sql);
}
示例12: GetAllComentsByUser
public function GetAllComentsByUser($user_id)
{
$params[] = intval($user_id);
$sql = 'SELECT *
FROM coments
WHERE user_id = ?';
$arr = DatabaseHandler::GetAll($sql, $params);
return $arr;
}
示例13: foreach
// B_A::b_a_Insert($blog_id, $audience['1']);
// }
// }
$result = '<div class="col-lg-12 col-md-6">
<div class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
ویرایش / افزودن بلاگ با موفقیت انجام شد. بلاگ مورد نظر غیر فعال بوده و برای فعال شدن از <a href="index.php?page=blog_list">لیست بلاگ ها</a> اقدام نمایید.
<br>
همچنین شما می توانید از <a href="../blog/detail.php?title=' . $title_en . '">این لینک</a> پیش نمایش بلاگ وارد شده را ببینید.
</div>
</div>';
}
}
if (isset($_GET["id"])) {
$update_blog = BLOGS::blogs_SelectRow($_GET["id"]);
$keywords = DatabaseHandler::GetAll("SELECT * FROM blog_keywords WHERE blog_id = '{$_GET['id']}' ; ");
foreach ($keywords as $keyword) {
$keywords_input .= $keyword["keyword"] . ' , ';
}
$title_input = $update_blog['title'];
$title_en_input = $update_blog['title_en'];
$image_input = $update_blog["image"];
$text_input = $update_blog['text'];
$source_input = $update_blog['source'];
$video_input = $update_blog['video'];
$description_input = $update_blog['description'];
$read_time_input = $update_blog['read_time'];
$submit = "update";
$page_title = "ویرایش بلاگ";
}
/**
示例14: sql_exec
/**
* Execute an SQL query on the database
*
* @param resource $db Database handler
* @param array $bindings Array of PDO binding values from bind() to be
* used for safely escaping strings. Note that this can be given as the
* SQL query string if no bindings are required.
* @param string $sql SQL query to execute.
* @return array Result from the query (all rows)
*/
static function sql_exec($bindings, $sql = null)
{
// Argument shifting
if ($sql === null) {
$sql = $bindings;
}
//$stmt = $db->prepare( $sql );
//echo $sql;
$result = DatabaseHandler::Prepare($sql);
// Bind parameters
if (is_array($bindings)) {
$result = DatabaseHandler::GetAllWithBinding($result, $bindings, PDO::FETCH_BOTH);
} else {
$result = DatabaseHandler::GetAll($result, null, PDO::FETCH_BOTH);
}
// Return all
return $result;
}
示例15: excuteReadAll
public function excuteReadAll($params = null)
{
$result = DatabaseHandler::Prepare($this->sql);
$result = DatabaseHandler::GetAll($result, $params);
return $result;
}