$result_set->lengths;
mysqli_fetch_lengths
The input parameter $result_set is the output of result set identifier of mysqli_query(), mysqli_store_result() or mysqli_use_result().
MySQLI database connection file
Example : Object Oriented Style<?Php require "config.php";// Database connection file. $query="select * from student where id=7 "; if ($result_set = mysqli_query($connection,$query)) { $row = mysqli_fetch_row($result_set); echo $row[1]."<br>"; foreach (mysqli_fetch_lengths($result_set) as $i => $val) { echo " Field No ". $i ." value: ".$val . ","; } } ?>
Krish Star Field No 0 value: 1, Field No 1 value: 10, Field No 2 value: 4, Field No 3 value: 2, Field No 4 value: 6,Procedural style
<?Php require "config.php";// Database connection file. $q="SELECT * FROM student where id=4"; if ($result = $connection->query($q)){ $row = $result->fetch_row(); echo $row[1]."<br>"; foreach ($result->lengths as $i => $val) { echo " Field No ". $i ." value: ".$val . ","; } $result->close(); } ?>