php mysql读取数组_php实现通用的从数据库表读取数据到数组的函数实例
生活随笔
收集整理的這篇文章主要介紹了
php mysql读取数组_php实现通用的从数据库表读取数据到数组的函数实例
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
本文實例講述了php實現通用的從數據庫表讀取數據到數組的函數。分享給大家供大家參考。具體分析如下:
此函數不關心表結構,只需要指定表名、結構和查詢條件既可以對表進行通用查詢操作,非常實用。
function listmytablerows($table, $name, $field, $where, $textID)
{
/ / Connect to the database and query execution
connect ();
$Sql = "select * from". $table. "". $where. "ORDER BY". $field;
$Req = mysql_query($sql);
$Res = mysql_num_rows($req);
?>
____ option>
Php
/ / We do a loop that will read the information for each record
while ($data = mysql_fetch_array($res))
{
/ / We display the information from the current record
?>
Option>
Php
}
?>
Select>
Php
}
?>
希望本文所述對大家的php程序設計有所幫助。
總結
以上是生活随笔為你收集整理的php mysql读取数组_php实现通用的从数据库表读取数据到数组的函数实例的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 内存条大PK:单通道VS双通道,性能对比
- 下一篇: mysql主节点1593从节点正常_my