词条 | mysql_result |
释义 | (PHP 4, PHP 5) mysql_result — 取得结果数据 说明mixed mysql_result ( resource $result , int $row [, mixed $field ] ) mysql_result() 返回 MySQL 结果集中一个单元的内容。字段参数可以是字段的偏移量或者字段名,或者是字段表点字段名(tablename.fieldname)。如果给列起了别名('select foo as bar from...'),则用别名替代列名。 当作用于很大的结果集时,应该考虑使用能够取得整行的函数(在下边指出)。这些函数在一次函数调用中返回了多个单元的内容,比 mysql_result() 快得多。此外注意在字段参数中指定数字偏移量比指定字段名或者 tablename.fieldname 要快得多。 调用 mysql_result() 不能和其它处理结果集的函数混合调用。 实例<?php $link = mysql_connect("localhost", "mysql_user", "mysql_password") or die("Could not connect: " . mysql_error()); $result = mysql_query("SELECT name FROM work.employee") or die("Could not query: . mysql_error()); echo mysql_result($result,2); // outputs third employee's name mysql_close($link); ?> |
随便看 |
百科全书收录4421916条中文百科知识,基本涵盖了大多数领域的百科知识,是一部内容开放、自由的电子版百科全书。