mysql_result
取得查询 (query) 的结果。
语法: int mysql_result(int result, int row, mixed field);
传回值: 整数内容说明
本函式取得一格 query 的结果。参数 field 可以是栏位名称、顺序或者是 FieldName.TableName 的格式。在传回资料量少时,可以使用本函式来处理。当资料库大时,本函式的效率就有待考量了,这时可以使用较有效率的 mysql_fetch_row()、mysql_fetch_array() 及 mysql_fetch_object() 等函式。
取得查询 (query) 的结果。
语法: int mysql_result(int result, int row, mixed field);
传回值: 整数内容说明
本函式取得一格 query 的结果。参数 field 可以是栏位名称、顺序或者是 FieldName.TableName 的格式。在传回资料量少时,可以使用本函式来处理。当资料库大时,本函式的效率就有待考量了,这时可以使用较有效率的 mysql_fetch_row()、mysql_fetch_array() 及 mysql_fetch_object() 等函式。
<?php
mysql_connect($host,$user,$password);
$result = mysql_db_query("database","select * from table");
while($row = mysql_fetch_array($result)) {
echo $row["user_id"];
echo $row["fullname"];
}
mysql_free_result($result);
?>