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


PHP mysqli_fetch_all函数代码示例

本文整理汇总了PHP中mysqli_fetch_all函数的典型用法代码示例。如果您正苦于以下问题:PHP mysqli_fetch_all函数的具体用法?PHP mysqli_fetch_all怎么用?PHP mysqli_fetch_all使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: execute_multi

function execute_multi($link, $arr_sqls, &$error)
{
    $sqls = implode(';', $arr_sqls) . ';';
    if (mysqli_multi_query($link, $sqls)) {
        $data = array();
        $i = 0;
        //计数
        do {
            if ($result = mysqli_store_result($link)) {
                $data[$i] = mysqli_fetch_all($result);
                mysqli_free_result($result);
            } else {
                $data[$i] = null;
            }
            $i++;
            if (!mysqli_more_results($link)) {
                break;
            }
        } while (mysqli_next_result($link));
        if ($i == count($arr_sqls)) {
            return $data;
        } else {
            $error = "sql语句执行失败:<br />&nbsp;数组下标为{$i}的语句:{$arr_sqls[$i]}执行错误<br />&nbsp;错误原因:" . mysqli_error($link);
            return false;
        }
    } else {
        $error = '执行失败!请检查首条语句是否正确!<br />可能的错误原因:' . mysqli_error($link);
        return false;
    }
}
开发者ID:sakuraliu,项目名称:bbs,代码行数:30,代码来源:mysql.inc.php

示例2: getResults

 public function getResults($sSQL)
 {
     $oQuery = mysqli_query($this->_connection, $sSQL);
     if ($oQuery) {
         return mysqli_fetch_all($oQuery, MYSQLI_ASSOC);
     }
     return false;
 }
开发者ID:ghtmh,项目名称:haushaltsplan,代码行数:8,代码来源:database.class.php

示例3: show_brand_goods

function show_brand_goods()
{
    $brand = $_GET['brand'];
    $link = mysqli_connect("localhost", "magUser", "Mag_user", "magazine");
    if (!$link) {
        echo "Ведутся технические работы";
        die;
    }
    $res = mysqli_query($link, "SELECT * FROM `t_products` WHERE `brand`= '{$brand}'");
    $main_brand = mysqli_fetch_all($res, MYSQLI_ASSOC);
    foreach ($main_brand as $key => $val) {
        ?>
			<article class="oneGood">
                    <a class="imgGood" href="#">
                        <img src="images/oneGood.png" alt="">
                    </a>
                    <p class="priceGood">
                        <?php 
        echo $main_brand[$key]['price'];
        ?>
                    </p>
                    <p class="descGood">
                        <a href="http://shop/cart.php?id=<?php 
        echo $main_brand[$key]['id'];
        ?>
"><?php 
        echo $main_brand[$key]['name'];
        ?>
</a>
                    </p>
                </article>

<?php 
    }
}
开发者ID:Garik917,项目名称:magazine,代码行数:35,代码来源:main_page.php

示例4: getCabinInclusions

function getCabinInclusions($link, $id)
{
    $query = "SELECT inclID, inclusionName, tblCabins_cabinID\n\t\tFROM tblInclusions, tblCabinInc\n\t\tWHERE tblInclusions.inclID = tblCabinInc.tblInclusions_InclID\n\t\tAND tblCabinInc.tblCabins_cabinID = {$id}";
    $result = mysqli_query($link, $query);
    $inclusions = mysqli_fetch_all($result, MYSQLI_ASSOC);
    return $inclusions;
}
开发者ID:arielse,项目名称:Sunnyspot,代码行数:7,代码来源:admin_menu.php

示例5: book

function book()
{
    global $database;
    $check_in = $_POST['checkIn'];
    $check_out = $_POST['checkOut'];
    $room_id = $_POST['roomId'];
    $sql = "SELECT * FROM bookings WHERE room_id = {$room_id} AND ( '{$check_in}' BETWEEN arrival AND departure ) OR ( '{$check_out}' BETWEEN arrival AND departure )";
    $result = $database->query($sql);
    $result = mysqli_fetch_all($result);
    if (!empty($result)) {
        $data = array('success' => false, 'message' => 'The room is already booked');
        echo json_encode($data);
    } else {
        $sql = "INSERT INTO bookings(room_id,arrival,departure)";
        $sql .= "VALUES({$room_id},'{$check_in}','{$check_out}')";
        $database->query($sql);
        $data = array('success' => true, 'message' => 'You booked the room');
        echo json_encode($data);
    }
    die;
    /*print_r( $result );
    		
    	
    		die();*/
}
开发者ID:kochevRisto,项目名称:project,代码行数:25,代码来源:ajax-callbacks.php

示例6: query

 public function query($sql)
 {
     $resource = mysqli_query($this->link, $sql);
     if ($resource != false) {
         if ($resource !== true && get_class($resource) == 'mysqli_result') {
             $data = array();
             if (function_exists('mysqli_fetch_all')) {
                 $data = mysqli_fetch_all($resource, MYSQLI_ASSOC);
             } else {
                 $i = 0;
                 while ($result = mysqli_fetch_assoc($resource)) {
                     $data[$i] = $result;
                     $i++;
                 }
             }
             $query = new stdClass();
             $query->row = isset($data[0]) ? $data[0] : array();
             $query->rows = $data;
             $query->num_rows = mysqli_num_rows($resource);
             mysqli_free_result($resource);
             unset($data);
             return $query;
         } else {
             return true;
         }
     } else {
         trigger_error('Error: ' . mysqli_error($this->link) . '<br />Error No: ' . mysqli_errno($this->link) . '<br />' . $sql);
         exit;
     }
 }
开发者ID:wharin,项目名称:quantum,代码行数:30,代码来源:mysql_i.php

示例7: updateList

function updateList($user, $nbmessages)
{
    $sql = "SELECT COUNT(*) FROM message";
    $result = mysqli_query(db(), $sql);
    $result = mysqli_fetch_all($result)[0][0];
    $DATA = ["new" => false, "message" => ""];
    if ($nbmessages < $result) {
        if ($nbmessages != 0) {
            $nbnew = $result - $nbmessages;
            $sql = "SELECT * FROM message ORDER BY date DESC LIMIT {$nbnew}";
            $result = mysqli_query(db(), $sql);
            $messages = mysqli_fetch_all($result, MYSQLI_ASSOC);
            $taille = count($messages);
            $message = $messages;
            for ($i = 1; $i < $taille - 1; $i++) {
                $messages[$i] = $message[$taille - $i];
            }
        } else {
            $sql = "SELECT * FROM message";
            $result = mysqli_query(db(), $sql);
            $messages = mysqli_fetch_all($result, MYSQLI_ASSOC);
        }
        foreach ($messages as $row) {
            if ($row['user'] == $user) {
                $DATA['message'] .= "<div class='sent'><p class='content' title='{$row['date']}'>{$row['msg']}</p><div class='icon'>me</div></div>";
            } else {
                $DATA['message'] .= "<div class='received'><div class='icon'>anonym</div><p class='content' title='{$row['date']}'>{$row['msg']}</p></div>";
                $DATA['new'] = true;
            }
        }
    }
    echo json_encode($DATA);
}
开发者ID:GuillaumeCa,项目名称:not-a-website,代码行数:33,代码来源:Messages.php

示例8: getAllAssoc

 public function getAllAssoc($sql)
 {
     $queryRes = $this->query($sql);
     $res = mysqli_fetch_all($queryRes, MYSQLI_ASSOC);
     if (!empty($res)) {
         return $res;
     }
 }
开发者ID:19eugen86,项目名称:schedro.extjs,代码行数:8,代码来源:database.class.php

示例9: findCarEngines

function findCarEngines($model)
{
    global $db;
    $query = 'SELECT * FROM car_engines WHERE model_id = ' . $model;
    $result = mysqli_query($db, $query);
    $engines = mysqli_fetch_all($result);
    echo json_encode($engines);
}
开发者ID:velsharoon,项目名称:advanced_scripting_2,代码行数:8,代码来源:handler.php

示例10: findCarEngines

function findCarEngines($makeId, $modelId)
{
    global $connection;
    $query = "SELECT * FROM engines WHERE make=" . $makeId . " AND model=" . $modelId;
    $result = mysqli_query($connection, $query);
    $engines = mysqli_fetch_all($result);
    echo json_encode($engines);
}
开发者ID:jukhadar,项目名称:web-scripting,代码行数:8,代码来源:handler.php

示例11: get_datakader_by_nim

function get_datakader_by_nim($nimkader)
{
    $info = array();
    include 'connectdb.php';
    $result = mysqli_query($con, 'SELECT tabel_data_kader.NIM, Nama_Mahasiswa, Organisasi, Posisi, Acara FROM tabel_mahasiswa, tabel_data_kader WHERE tabel_data_kader.NIM = ' . $nimkader . ' AND tabel_mahasiswa.NIM = ' . $nimkader);
    $info = mysqli_fetch_all($result, MYSQL_ASSOC);
    return $info;
}
开发者ID:AndraWP,项目名称:18213003-18213004,代码行数:8,代码来源:event-api.php

示例12: getList

 public function getList($limit = 0, $offset = 0)
 {
     $sql = 'select * from films';
     $limit ? $sql = $sql . ' limit ' . intval($limit) : '';
     $limit && $offset ? $sql = $sql . ' offset ' . intval($limit) : '';
     $result = $this->query($sql);
     return mysqli_fetch_all($result, MYSQLI_ASSOC);
 }
开发者ID:Balfin,项目名称:tfi,代码行数:8,代码来源:Film.php

示例13: sqlQuerySelect

function sqlQuerySelect($sqlQuery)
{
    $connect = sqlConnect();
    $result = mysqli_query($connect, $sqlQuery);
    $data = mysqli_fetch_all($result, MYSQLI_ASSOC);
    mysqli_close($connect);
    return $data;
}
开发者ID:RMMusic,项目名称:DB_in_Form_PHP,代码行数:8,代码来源:functions.php

示例14: db_select

function db_select($select_query)
{
    global $conn;
    $result = mysqli_query($conn, $select_query);
    $assoc = mysqli_fetch_all($result, MYSQL_ASSOC);
    //mysqli_free_result($result);
    return $assoc;
}
开发者ID:hoangdongtien,项目名称:eprojectmate,代码行数:8,代码来源:database.php

示例15: allPosts

 public static function allPosts()
 {
     $sql = "SELECT * FROM %s";
     $query = sprintf($sql, self::$table);
     $result = mysqli_query(self::connect(), $query);
     $allPostsArr = mysqli_fetch_all($result, MYSQLI_ASSOC);
     return $allPostsArr;
 }
开发者ID:vosaan,项目名称:blog.local,代码行数:8,代码来源:db_conn.php


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