php mysqli_fetch_lengths()函数怎么用?
mysqli_fetch_lengths()函数返回结果集中的字段长度。
语法:
mysqli_fetch_lengths(result);
参数
result:必需。规定由 mysqli_query()、mysqli_store_result() 或 mysqli_use_result() 返回的结果集标识符。
返回值: 若成功,则该函数返回一个数字数组,若出错或没有其他的行,则返回 false。
php mysqli_fetch_lengths()函数 示例
返回结果集中的字段长度:
<?php
// 假定数据库用户名:root,密码:123456,数据库:data
$con=mysqli_connect("localhost","root","123456","data");
if (mysqli_connect_errno($con))
{
echo "连接 MySQL 失败: " . mysqli_connect_error();
}
$sql="SELECT name,url FROM websites ORDER BY alexa";
if ($result=mysqli_query($con,$sql))
{
$row=mysqli_fetch_row($result);
// 显示字段长度
foreach (mysqli_fetch_lengths($result) as $i=>$val)
{
printf("字段 %2d 长度为: %2d",$i+1,$val);
echo "<br>";
}
// 释放结果集
mysqli_free_result($result);
}
mysqli_close($con);
?>以上就是php mysqli_fetch_lengths函数怎么用的详细内容,更多请关注Gxl网其它相关文章!
查看更多关于phpmysqli_fetch_lengths函数怎么用的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did60843