PHP의 mysqli_fetch_lengths () 함수
반환 결과 집합 필드 길이 :
<?php // 假定数据库用户名:root,密码:123456,数据库:w3big $con=mysqli_connect("localhost","root","123456","w3big"); 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); ?>
정의 및 사용
mysqli_fetch_lengths () 함수는 결과 세트 필드 길이를 반환합니다.
문법
mysqli_fetch_lengths( result ) ;
参数 | 描述 |
---|---|
result | 必需。规定由 mysqli_query()、mysqli_store_result() 或 mysqli_use_result() 返回的结果集标识符。 |
기술 세부 사항
반환 값 : | 정수 배열의 각 필드 (열)의 길이를 나타내는 경우 에러가 발생할 경우 FALSE를 반환 반환된다. |
---|---|
PHP 버전 : | 5+ |
PHP mysqli 함수 참조 설명서