久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何使用一個查詢從 mysql 中選擇多行并在 php 中

How to select multiple rows from mysql with one query and use them in php(如何使用一個查詢從 mysql 中選擇多行并在 php 中使用它們)
本文介紹了如何使用一個查詢從 mysql 中選擇多行并在 php 中使用它們的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我目前有一個如下圖所示的數據庫.

I currently have a database like the picture below.

其中有一個查詢選擇了 number1 等于 1 的行.當使用

Where there is a query that selects the rows with number1 equaling 1. When using

mysql_fetch_assoc()

在 php 中我只得到第一個有沒有辦法得到第二個?就像通過像

in php I am only given the first is there any way to get the second? Like through a dimesional array like

array['number2'][2] 

或類似的東西

推薦答案

使用重復調用 mysql_fetch_assoc.它記錄在 PHP 手冊中.

Use repeated calls to mysql_fetch_assoc. It's documented right in the PHP manual.

http://php.net/manual/function.mysql-fetch-assoc.php

// While a row of data exists, put that row in $row as an associative array
// Note: If you're expecting just one row, no need to use a loop
// Note: If you put extract($row); inside the following loop, you'll
//       then create $userid, $fullname, and $userstatus
while ($row = mysql_fetch_assoc($result)) {
    echo $row["userid"];
    echo $row["fullname"];
    echo $row["userstatus"];
}

如果需要,您可以使用它來構建多維數組,以便在腳本的其他部分使用.

If you need to, you can use this to build up a multidimensional array for consumption in other parts of your script.

這篇關于如何使用一個查詢從 mysql 中選擇多行并在 php 中使用它們的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Joining 2 tables in SELECT(MYSQL/PHP)(在 SELECT(MYSQL/PHP) 中加入 2 個表)
How to make lt;option selected=quot;selectedquot;gt; set by MySQL and PHP?(如何使lt;option selected=“selectedgt;由 MySQL 和 PHP 設置?)
Auto populate a select box using an array in PHP(使用 PHP 中的數組自動填充選擇框)
PHP SQL SELECT where like search item with multiple words(PHP SQL SELECT where like search item with multiple words)
json_encode produce JSON_ERROR_UTF8 from MSSQL-SELECT(json_encode 從 MSSQL-SELECT 產生 JSON_ERROR_UTF8)
MySQL ORDER BY rand(), name ASC(MySQL ORDER BY rand(),名稱 ASC)
主站蜘蛛池模板: 欧美三区在线观看 | 一级做a爰片久久毛片 | 伊人中文字幕 | 亚洲精品大全 | 国产欧美一区二区三区日本久久久 | 91色视频在线观看 | 久草视频网站 | 亚洲精品白浆高清久久久久久 | 在线视频一区二区三区 | 97人人草 | 亭亭五月激情 | 亚洲综合日韩精品欧美综合区 | 精品久久九九 | 亚洲福利在线视频 | 国产福利资源在线 | a级黄色毛片免费播放视频 国产精品视频在线观看 | 久久久成人免费视频 | 一区二区在线免费观看 | 国产精品一区三区 | 亚洲视频在线观看 | 国产精品久久久久久久7电影 | 成人在线视频免费观看 | 激情欧美日韩一区二区 | 日本不卡一区二区 | 国产成人精品一区二区 | 日本 欧美 三级 高清 视频 | av网站免费观看 | 欧美日韩视频一区二区 | 久久婷婷香蕉热狠狠综合 | 欧美一级大片免费观看 | 天天干天天想 | 久草热8精品视频在线观看 午夜伦4480yy私人影院 | 中文字幕av亚洲精品一部二部 | 久久精品国产精品青草 | 成人在线免费电影 | 91成人免费| 日韩精彩视频 | 视频一区在线观看 | 欧美精品一 | 东京久久 | 四虎成人在线播放 |