PHP mysqli fetch_all() and fetch_field() Function

Program 1

<html>
<body>
 <center>
<pre>
<?php
  $mycon=$mycon=mysqli_connect("localhost","root","","Library") or die("Connection not success");
    //echo "Connection success";
  $sql="select * from studentdata";
   $record=$mycon->query($sql);
   //$row=mysqli_fetch_all($record,MYSQLI_NUM);
//   print_r($row);
//   foreach($row as $value)
//   {
//        echo $value[0]."  ".$value[1]."  ".$value[2]."  ".$value[3]."  ".$value[4]."<br> ";
//   }
// $row=mysqli_fetch_all($record,MYSQLI_ASSOC);
//   foreach($row as $value)
//   {
//        echo $value['sid']."  ".$value['sname']."  ".$value['phy']."  ".$value['chem']."  ".$value['math']."<br> ";
//   }
    
$fieldinfo= mysqli_fetch_field( $record);
print_r($fieldinfo);
$mycon->close();

  //mysqli_fetch_assoc()
//   mysqli_fetch_array()
//   mysqli_fetch_row()
//   mysqli_fetch_field()
//   mysqli_fetch_all()
?>
</tr>
</pre>
</center>
</body>
</html>

 

courses

TechVidvan Team

TechVidvan Team provides high-quality content & courses on AI, ML, Data Science, Data Engineering, Data Analytics, programming, Python, DSA, Android, Flutter, full stack web dev, MERN, and many latest technology.

Leave a Reply

Your email address will not be published. Required fields are marked *