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


PHP Database::fetch_all_array方法代码示例

本文整理汇总了PHP中Database::fetch_all_array方法的典型用法代码示例。如果您正苦于以下问题:PHP Database::fetch_all_array方法的具体用法?PHP Database::fetch_all_array怎么用?PHP Database::fetch_all_array使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Database的用法示例。


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

示例1: all

 public function all()
 {
     $db = new Database();
     $db->connect();
     $obj = $db->fetch_all_array("select * from " . $this->table_name_full);
     $db->close();
     return new response(array('body' => $obj));
 }
开发者ID:xFanly,项目名称:prest,代码行数:8,代码来源:restdb.php

示例2: getAllTransferForEvent

 public function getAllTransferForEvent($eventId, $mode)
 {
     $sql = "select * from transfer where event_id=" . $eventId . " and mode='" . $mode . "'";
     $db = new Database();
     $db->connect();
     $allTransfer = $db->fetch_all_array($sql);
     $db->close();
     return $allTransfer;
 }
开发者ID:rapude,项目名称:dhamma-reise,代码行数:9,代码来源:Transfer.class.php

示例3: getAllCentres

 public function getAllCentres()
 {
     $sql = "select * from centre";
     $db = new Database();
     $db->connect();
     $allCentres = $db->fetch_all_array($sql);
     $db->close();
     return $allCentres;
 }
开发者ID:rapude,项目名称:dhamma-reise,代码行数:9,代码来源:Centre.class.php

示例4: getEventsByCentreIdent

 public function getEventsByCentreIdent($centreIdent)
 {
     $sql = "select * from event where centre_fk='{$centreIdent}'order by ev_date asc";
     $db = new Database();
     $db->connect();
     $events = $db->fetch_all_array($sql);
     $db->close();
     return $events;
 }
开发者ID:rapude,项目名称:dhamma-reise,代码行数:9,代码来源:Event.class.php

示例5: numBadReviews

function numBadReviews()
{
    $db = new Database(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
    $numReviews = 0;
    for ($i = 1; $i <= 100; $i++) {
        // First we select a random film from the first 1000
        $db->connect();
        $result = $db->query("SELECT * FROM films WHERE position = " . $i);
        $film = $db->fetch_array_assoc($result);
        if (!$film) {
            continue;
        }
        echo $film['name'] . PHP_EOL;
        // Let's get film's bad reviews
        $db->connect();
        $reviews = $db->fetch_all_array("SELECT * FROM reviews WHERE id = '" . $film['id'] . "' AND rating <= 2");
        foreach ($reviews as $review) {
            echo $review['title'] . PHP_EOL;
        }
        $numReviews += count($reviews);
        echo "Num reviews: " . $numReviews . PHP_EOL;
    }
    echo "Total reviews: " . $numReviews;
}
开发者ID:brunogarcia,项目名称:filmaffinity,代码行数:24,代码来源:test.php

示例6: die

 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 */
session_start();
if (!isset($_SESSION['CPM']) || $_SESSION['CPM'] != 1) {
    die('Hacking attempt...');
}
global $k, $settings;
include '../includes/settings.php';
header("Content-type: text/x-json; charset=" . $k['charset']);
require_once "class.database.php";
$db = new Database($server, $user, $pass, $database, $pre);
$db->connect();
$sql = "SELECT id, category FROM " . $pre . "kb_categories";
//manage filtering
if (!empty($_GET['term'])) {
    $sql .= " WHERE category LIKE '%" . $_GET['term'] . "%'";
}
$sql .= " ORDER BY category ASC";
$sOutput = '';
$rows = $db->fetch_all_array($sql);
if ($rows[0] > 0) {
    foreach ($rows as $reccord) {
        if (empty($sOutput)) {
            $sOutput = '"' . $reccord['category'] . '"';
        } else {
            $sOutput .= ', "' . $reccord['category'] . '"';
        }
    }
    //Finish the line
    echo '[ ' . $sOutput . ' ]';
}
开发者ID:sleepy909,项目名称:cpassman,代码行数:31,代码来源:kb.queries.categories.php

示例7: date

 //Add font for utf-8
 $pdf->AddFont('DejaVu', '', 'DejaVuSansCondensed.ttf', true);
 $pdf->AliasNbPages();
 $pdf->AddPage();
 $pdf->SetFont('DejaVu', '', 16);
 $pdf->Cell(0, 10, $txt['pdf_del_title'], 0, 1, 'C', false);
 $pdf->SetFont('DejaVu', '', 12);
 $pdf->Cell(0, 10, $txt['pdf_del_date'] . date($_SESSION['settings']['date_format'] . " " . $_SESSION['settings']['time_format'], mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y"))), 0, 1, 'C', false);
 $pdf->SetFont('DejaVu', '', 10);
 $pdf->SetFillColor(15, 86, 145);
 $pdf->cell(80, 6, $txt['label'], 1, 0, "C", 1);
 $pdf->cell(75, 6, $txt['group'], 1, 0, "C", 1);
 $pdf->cell(21, 6, $txt['date'], 1, 0, "C", 1);
 $pdf->cell(15, 6, $txt['author'], 1, 1, "C", 1);
 $pdf->SetFont('DejaVu', '', 10);
 $rows = $db->fetch_all_array("\r\n            SELECT u.login AS login, i.label AS label, i.id_tree AS id_tree\r\n            FROM " . $pre . "log_items AS l\r\n            INNER JOIN " . $pre . "users AS u ON (u.id=l.id_user)\r\n            INNER JOIN " . $pre . "items AS i ON (i.id=l.id_item)\r\n            WHERE l.action = 'Modification'\r\n            AND l.raison = 'Mot de passe chang?'\r\n        ");
 foreach ($rows as $reccord) {
     if (date($_SESSION['settings']['date_format'], $reccord['date']) == $_POST['date']) {
         //information about the pw creator
         $res_user = mysql_query("SELECT login FROM " . $pre . "users WHERE id = '" . $reccord['id_user'] . "'");
         $data_user = mysql_fetch_row($res_user);
         //information about the pw itself
         $res_item = mysql_query("SELECT label, id_tree FROM " . $pre . "items WHERE id = '" . $reccord['id_item'] . "'");
         $data_item = mysql_fetch_row($res_item);
         //get the tree grid
         $arbo = $tree->getPath($reccord['id_tree'], true);
         $arboTxt = "";
         foreach ($arbo as $elem) {
             if (empty($arboTxt)) {
                 $arboTxt = $elem->title;
             } else {
开发者ID:sleepy909,项目名称:cpassman,代码行数:31,代码来源:views.queries.php

示例8: switch

 if (isset($_POST['type'])) {
     switch ($_POST['type']) {
         // CASE where DELETING a group
         case "delete_folder":
             $folders_deleted = "";
             // this will delete all sub folders and items associated
             $tree = new NestedTree($pre . 'nested_tree', 'id', 'parent_id', 'title');
             // Get through each subfolder
             $folders = $tree->getDescendants($_POST['id'], true);
             foreach ($folders as $folder) {
                 //Store the deleted folder (recycled bin)
                 $db->query_insert('misc', array('type' => 'folder_deleted', 'intitule' => "f" . $_POST['id'], 'valeur' => $folder->id . ',' . $folder->parent_id . ',' . $folder->title . ',' . $folder->nleft . ',' . $folder->nright . ',' . $folder->nlevel . ',0,0,0,0'));
                 //delete folder
                 $db->query("DELETE FROM " . $pre . "nested_tree WHERE id = " . $folder->id);
                 //delete items & logs
                 $items = $db->fetch_all_array("SELECT id FROM " . $pre . "items WHERE id_tree='" . $folder->id . "'");
                 foreach ($items as $item) {
                     //Delete item
                     //$db->query("DELETE FROM ".$pre."items WHERE id = ".$item['id']);
                     //$db->query("DELETE FROM ".$pre."log_items WHERE id_item = ".$item['id']);
                     $db->query_update("items", array('inactif' => '1'), "id = " . $item['id']);
                     //log
                     $db->query_insert("log_items", array('id_item' => $item['id'], 'date' => mktime(date('H'), date('i'), date('s'), date('m'), date('d'), date('y')), 'id_user' => $_SESSION['user_id'], 'action' => 'at_delete'));
                 }
                 //Actualize the variable
                 $_SESSION['nb_folders']--;
             }
             //rebuild tree
             $tree = new NestedTree($pre . 'nested_tree', 'id', 'parent_id', 'title');
             $tree->rebuild();
             //Update CACHE table
开发者ID:sleepy909,项目名称:cpassman,代码行数:31,代码来源:folders.queries.php

示例9: Database

<?php

require '../common/database.php';
require '../config/config.php';
$db = new Database($db_host, $db_username, $db_password, $db_name);
$db->connect();
$sql = "SELECT * from " . $TABLE_EYO_MAP . " where status=1";
$map_result = $db->fetch_all_array($sql);
?>
<!DOCTYPE html>
<html>
	<head>
	<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
	<meta charset="utf-8">
	<title>Eyo Map Plugin</title>
	<meta name="description" content="A demo of maps with multiple markers and infowindow" />
	<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
	<style>
html, body, #map-canvas {
	height: 100%;
	margin: 0px;
	padding: 0px
}
</style>
	<script type="text/javascript">

var LocationData = [
	<?php 
foreach ($map_result as $map) {
    ?>
	[<?php 
开发者ID:saifuddinsarker,项目名称:Google_Map_Ext,代码行数:31,代码来源:index.php

示例10: NestedTree

     #-------------------------------------------
     #CASE refresh the matrix
 #-------------------------------------------
 #CASE refresh the matrix
 case "rafraichir_matrice":
     echo 'document.getElementById(\'matrice_droits\').innerHTML = "";';
     require_once "NestedTree.class.php";
     $tree = new NestedTree($pre . 'nested_tree', 'id', 'parent_id', 'title');
     $tree = $tree->getDescendants();
     $texte = '<table><thead><tr><th>' . $txt['group'] . 's</th>';
     $gpes_ok = array();
     $gpes_nok = array();
     $tab_fonctions = array();
     $arrRoles = array();
     //Display table header
     $rows = $db->fetch_all_array("SELECT title,id FROM " . $pre . "roles_title ORDER BY title ASC");
     foreach ($rows as $reccord) {
         $texte .= '<th style="font-size:10px;" class="edit_role">' . $reccord['title'] . '<br><img src=\'includes/images/ui-tab--pencil.png\' onclick=\'edit_this_role(' . $reccord['id'] . ',"' . $reccord['title'] . '")\' style=\'cursor:pointer;\' \\>&nbsp;<img src=\'includes/images/ui-tab--minus.png\' onclick=\'delete_this_role(' . $reccord['id'] . ',"' . $reccord['title'] . '")\' style=\'cursor:pointer;\' \\></th>';
         array_push($arrRoles, $reccord['id']);
     }
     $texte .= '</tr></thead><tbody>';
     //Display each folder with associated rights by role
     $i = 0;
     foreach ($tree as $node) {
         if (in_array($node->id, $_SESSION['groupes_visibles']) && !in_array($node->id, $_SESSION['personal_visible_groups'])) {
             $ident = "";
             for ($a = 1; $a < $node->nlevel; $a++) {
                 $ident .= "&nbsp;&nbsp;";
             }
             //display 1st cell of the line
             $texte .= '<tr><td style="font-size:10px; font-family:arial;">' . $ident . $node->title . '</td>';
开发者ID:omusico,项目名称:isle-web-framework,代码行数:31,代码来源:roles.queries.php

示例11: array

 case "admin":
     $db->query_update("users", array('admin' => $_POST['value']), "id = " . $_POST['id']);
     break;
     ## UPDATE PERSONNAL FOLDER FOR USER ##
 ## UPDATE PERSONNAL FOLDER FOR USER ##
 case "personal_folder":
     $db->query_update("users", array('personal_folder' => $_POST['value']), "id = " . $_POST['id']);
     break;
     //CHANGE USER FUNCTIONS
 //CHANGE USER FUNCTIONS
 case "open_div_functions":
     $text = "";
     //Refresh list of existing functions
     $data_user = $db->fetch_row("SELECT fonction_id FROM " . $pre . "users WHERE id = " . $_POST['id']);
     $users_functions = explode(';', $data_user[0]);
     $rows = $db->fetch_all_array("SELECT id,title FROM " . $pre . "roles_title");
     foreach ($rows as $reccord) {
         $text .= '<input type=\\"checkbox\\" id=\\"cb_change_function-' . $reccord['id'] . '\\"';
         if (in_array($reccord['id'], $users_functions)) {
             $text .= ' checked';
         }
         $text .= '>&nbsp;' . $reccord['title'] . '<br />';
     }
     //update page
     echo 'document.getElementById("change_user_functions_list").innerHTML = "' . $text . '";';
     echo 'document.getElementById("selected_user").value = "' . $_POST['id'] . '";';
     //display dialogbox
     echo '$("#change_user_functions").dialog("open");';
     echo '$("#div_loading").hide()';
     //hide loading div
     break;
开发者ID:omusico,项目名称:isle-web-framework,代码行数:31,代码来源:users.queries.php

示例12: Database

/**
 * The plugin control panel, you can manage the plugins activity in this page.
 */
include_once 'phphooks.class.php';
include_once 'includes/database.class.php';
require_once 'config.php';
$db = new Database($mysql_db_host, $mysql_db_user, $mysql_db_passwd, $mysql_db_name, $table_prefix);
$db->connect();
switch ($_GET['action']) {
    case "deactivate":
        $data['action'] = 0;
        $db->query_update("plugins", $data, "filename='" . $_GET['filename'] . "'");
        break;
    case "activate":
        $sql = "SELECT * FROM " . $table_prefix . "plugins WHERE filename = '" . $db->escape($_GET['filename']) . "'";
        $count = count($db->fetch_all_array($sql));
        if ($count < 1) {
            $data['filename'] = $_GET['filename'];
            $data['action'] = 1;
            $db->query_insert("plugins", $data);
        } else {
            $data['action'] = 1;
            $db->query_update("plugins", $data, "filename='" . $_GET['filename'] . "'");
        }
        break;
}
$sql = "SELECT filename, action FROM " . $table_prefix . "plugins WHERE action = '" . $db->escape(1) . "'";
$result_rows = $db->fetch_all_array($sql);
$plugin_list = new phphooks();
$plugin_headers = $plugin_list->get_plugins_header();
?>
开发者ID:sofagris,项目名称:phphooks,代码行数:31,代码来源:control.php

示例13: FPDF

 include '../includes/libraries/fpdf/pdf.fonctions.php';
 $pdf = new FPDF();
 $pdf->AliasNbPages();
 $pdf->AddPage();
 $pdf->SetFont('Arial', 'B', 16);
 $pdf->Cell(0, 10, $txt['pdf_del_title'], 0, 1, 'C', false);
 $pdf->SetFont('Arial', 'I', 12);
 $pdf->Cell(0, 10, $txt['pdf_del_date'] . date($_SESSION['settings']['date_format'] . " " . $_SESSION['settings']['time_format'], mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y"))), 0, 1, 'C', false);
 $pdf->SetFont('Arial', 'B', 10);
 $pdf->SetFillColor(15, 86, 145);
 $pdf->cell(80, 6, $txt['label'], 1, 0, "C", 1);
 $pdf->cell(75, 6, $txt['group'], 1, 0, "C", 1);
 $pdf->cell(21, 6, $txt['date'], 1, 0, "C", 1);
 $pdf->cell(15, 6, $txt['author'], 1, 1, "C", 1);
 $pdf->SetFont('Arial', '', 10);
 $rows = $db->fetch_all_array("\r\n            SELECT u.login AS login, i.label AS label, i.id_tree AS id_tree \r\n            FROM " . $pre . "log_items AS l \r\n            INNER JOIN " . $pre . "users AS u ON (u.id=l.id_user) \r\n            INNER JOIN " . $pre . "items AS i ON (i.id=l.id_item) \r\n            WHERE l.action = 'Modification' \r\n            AND l.raison = 'Mot de passe changé'\r\n        ");
 foreach ($rows as $reccord) {
     if (date($_SESSION['settings']['date_format'], $reccord['date']) == $_POST['date']) {
         //information about the pw creator
         $res_user = mysql_query("SELECT login FROM " . $pre . "users WHERE id = '" . $reccord['id_user'] . "'");
         $data_user = mysql_fetch_row($res_user);
         //information about the pw itself
         $res_item = mysql_query("SELECT label, id_tree FROM " . $pre . "items WHERE id = '" . $reccord['id_item'] . "'");
         $data_item = mysql_fetch_row($res_item);
         //get the tree grid
         $arbo = $tree->getPath($reccord['id_tree'], true);
         $arboTxt = "";
         foreach ($arbo as $elem) {
             if (empty($arboTxt)) {
                 $arboTxt = $elem->title;
             } else {
开发者ID:omusico,项目名称:isle-web-framework,代码行数:31,代码来源:views.queries.php

示例14: Database

 $db = new Database(DB_SERVER, DB_USER, DB_PASS, DB_DATABASE);
 if (strlen($app_token) <= 0) {
     echo '<html>';
     echo '<body>';
     echo 'App token is required.';
     echo '</body>';
     echo '</html>';
     exit(0);
 }
 $app = null;
 $app_files = null;
 $db->connect();
 $tokens = $db->query_first("SELECT appid FROM app_tokens WHERE token = '{$app_token}'");
 if ($tokens && isset($tokens["appid"])) {
     $app_id = $tokens["appid"];
     $user_app = $db->fetch_all_array("SELECT * FROM user_app WHERE privacy = 'private' AND appid = {$app_id}");
     if ($user_app && count($user_app)) {
         if (!$user_token) {
             // not authorized error
             $error = array("senchafiddle" => array("error" => "Unauthorized access. User token is required."));
             echo json_encode($error);
             $db->close();
             exit(0);
         }
         //take uid from token
         $user = $db->query_first("SELECT uid FROM user_tokens WHERE token = '{$user_token}'");
         if (!$user || !isset($user["uid"])) {
             // not authorized error
             $error = array("senchafiddle" => array("error" => "Unauthorized access. User token is invalid."));
             echo json_encode($error);
             $db->close();
开发者ID:dataReactive,项目名称:Sencha-Fiddle,代码行数:31,代码来源:full.php

示例15: array

 }
 //ADD item
 $new_id = $db->query_insert('items', array('label' => stripslashes($_POST['label']), 'description' => addslashes($_POST['desc']), 'pw' => $pw, 'url' => mysql_real_escape_string(stripslashes($_POST['url'])), 'id_tree' => $_POST['categorie'], 'login' => stripslashes($_POST['login']), 'inactif' => '0', 'restricted_to' => $resticted_to, 'perso' => $_POST['salt_key_set'] == 1 && isset($_POST['salt_key_set']) && $_POST['if_pf'] == 1 && isset($_POST['if_pf']) ? '1' : '0', 'anyone_can_modify' => $_POST['anyone_can_modify'] == "on" ? '1' : '0'));
 //log
 $db->query_insert('log_items', array('id_item' => $new_id, 'date' => mktime(date('H'), date('i'), date('s'), date('m'), date('d'), date('y')), 'id_user' => $_SESSION['user_id'], 'action' => 'at_creation'));
 //Add tags
 $tags = explode(' ', $_POST['tags']);
 foreach ($tags as $tag) {
     if (!empty($tag)) {
         $db->query_insert('tags', array('item_id' => $new_id, 'tag' => strtolower($tag)));
     }
 }
 // Check if any files have been added
 if (!empty($_POST['random_id_from_files'])) {
     $sql = "SELECT id\r\n                            FROM " . $pre . "files\r\n                            WHERE id_item=" . $_POST['random_id_from_files'];
     $rows = $db->fetch_all_array($sql);
     foreach ($rows as $reccord) {
         //update item_id in files table
         $db->query_update('files', array('id_item' => $new_id), "id='" . $reccord['id'] . "'");
     }
 }
 //Update CACHE table
 UpdateCacheTable("add_value", $new_id);
 //Announce by email?
 if ($_POST['annonce'] == 1) {
     require_once "class.phpmailer.php";
     //envoyer email
     $destinataire = explode(';', $_POST['diffusion']);
     foreach ($destinataire as $mail_destinataire) {
         //envoyer ay destinataire
         $mail = new PHPMailer();
开发者ID:omusico,项目名称:isle-web-framework,代码行数:31,代码来源:items.queries.php


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