PHP查询MysqL数据库并将结果保存到数组
主要用到了MysqL_fetch_assoc函数
/**
* PHP查询MysqL数据库并将结果保存到数组
*
* @param
* @arrange 512-笔记网: jb51.cc
**/
array MysqL_fetch_assoc (resource $Result_Set)
{-范例代码如下--}
<?PHP
$UserName = 'abc';
$Password = '1234';
$DbHandle = MysqL_connect ('localhost',$UserName,$Password);
if (!$DbHandle) {
die 'No database connection could be established.';
}
$DBName = 'w3db;
if (!MysqL_select_db ($DBName,$DbHandle)) {
die 'Database could not be selected.';
}
$Query = "SELECT ISBN,Title,Author FROM articles";
$articles = MysqL_query ($Query,$DbHandle));
while ($Row = MysqL_fetch_assoc ($articles)) {
echo "ISBN = $Row['ISBN']<br />\n";
echo "Title = $Row['Title']<br />\n";
echo "Author = $Row['Author']<br />\n";
}
?>
/*** 来自编程之家 jb51.cc(jb51.cc) ***/
原文链接:https://www.f2er.com/php/528452.html