MysqL_fetch_object函数用于,提取结果行从一个MysqL的结果集作为objectiative数组。
MysqL_fetch_object语法:
/**
* PHP MysqL MysqL_fetch_object - 从查询结果中获取对象集
*
* @param
* @arrange 512-笔记网: 512Pic.com
**/
array MysqL_fetch_object (resource $Result_Set)
/*** 来自编程之家 jb51.cc(jb51.cc) ***/
Result_Set句柄返回一个MysqL_query查询结果集。如果执行成功返回包含了所有数据行的object,如果失败则返回bool值
下面是演示代码:
/**
* PHP MysqL MysqL_fetch_object - 从查询结果中获取对象集
*
* @param
* @arrange 512-笔记网: 512Pic.com
**/
<?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_object ($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/528455.html