PHP mysqli fetch_row() 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);
      $n=mysqli_num_rows($record);
      //echo "Total Record: ".$n;
          echo "Row Function<br>";
        $row=mysqli_fetch_row($record);
        //print_r($row);
    //    echo $row[0]."  ".$row[1]."  ".$row[2]." ".$row[3]." ".$row[4];
   if($n>0)
   {
      while($row=mysqli_fetch_row($record))
      {
         echo $row[0]."  ".$row[1]."  ".$row[2]." ".$row[3]." ".$row[4];
          echo "<br>";
      }
    }
    else
    echo "<font color=red size=5>No Record found</font>";  
$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 *