加入收藏 | 设为首页 | 会员中心 | 我要投稿 安卓应用网 (https://www.0791zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > PHP > 正文

php mysqli_field_seek()函数

发布时间:2020-05-25 02:18:54 所属栏目:PHP 来源:互联网
导读:php mysqli_field_seek()函数将列光标设置为给定的列偏移量。本文章向大家介绍mysqli_field_seek() 函数的基本语法和使用实例,需要的朋友可以参考一下。

定义

mysqli_field_seek()函数将列光标设置为给定的列偏移量。

语法

mysqli_field_seek(result,fieldNumber);

参数

参数

是否必须

描述

result

需要。

由mysqli_query(),mysqli_store_result()或mysqli_use_result()返回的结果集标识符

fieldNumber

需要。

列号。必须是介于0和number_of_columns -1之间的整数

返回值

成功返回TRUE,失败返回FALSE。

实例

以下代码将字段游标设置为结果集中的第一列,然后使用mysqli_fetch_field()获取列信息,并打印字段的名称,表和最大长度。

// http://www.manongjc.com/article/1666.html

// 作者:脚本之家教程

$con=mysqli_connect("localhost","my_user","my_password","my_db");

if (mysqli_connect_errno($con)){

echo "Failed to connect to MySQL: " . mysqli_connect_error();

}

$sql="SELECT name FROM emp";

if ($result=mysqli_query($con,$sql)){

// Get field info for 1st column ("Lastname")

mysqli_field_seek($result,0);

$fieldinfo=mysqli_fetch_field($result);

print $fieldinfo->name;

print $fieldinfo->table;

print $fieldinfo->max_length;

// Free result set

mysqli_free_result($result);

}

mysqli_close($con);

?>

(编辑:安卓应用网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读