PHP 中的 mysqli fetch lengths函数

首页 / PHP入门教程 / PHP 中的 mysqli fetch lengths函数

mysqli fetch lengths - 语法

mysqli_fetch_lengths(result);

它用于返回输出中字段的长度

Sr.No 参数 & Description
1

result

它指定mysqli_query()、mysqli_store_result()或mysqli_use_result()返回的输出集标识符

无涯教程网

mysqli fetch lengths - 返回值

如果INTEGER表示每列的大小,则返回数组;如果失败,则返回FALSE

链接:https://www.learnfk.comhttps://www.learnfk.com/php/php-mysqli-fetch-lengths.html

来源:LearnFk无涯教程网

mysqli fetch lengths - 示例

<?php
   $connection_mysql=mysqli_connect("localhost","user","password","db");
   
   if (mysqli_connect_errno($connection_mysql)){
      echo "Failed to connect to MySQL: " . mysqli_connect_error();
   }
   $sql="SELECT * FROM emp ";
   
   if ($result=mysqli_query($connection_mysql,$sql)){
      $row=mysqli_fetch_row($result);
   
      foreach (mysqli_fetch_lengths($result) as $i=>$val){
         printf("Field %2d has length: %2d\n",$i+1,$val);
      }
   
      mysqli_free_result($result);
   }
   mysqli_close($connection_mysql);
?>

祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)

技术教程推荐

技术领导力实战笔记 -〔TGO鲲鹏会〕

数据分析实战45讲 -〔陈旸〕

Web协议详解与抓包实战 -〔陶辉〕

编辑训练营 -〔总编室〕

人人都能学会的编程入门课 -〔胡光〕

分布式系统案例课 -〔杨波〕

Flink核心技术与实战 -〔张利兵〕

快速上手C++数据结构与算法 -〔王健伟〕

Python实战 · 从0到1搭建直播视频平台 -〔Barry〕

好记忆不如烂笔头。留下您的足迹吧 :)