PHP mysqli fetch_assoc() Function
by TechVidvan Team
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;
while($row=mysqli_fetch_row($record))
echo $row['sid']." ".$row['sname']." ".$row['phy']." ".$row['chem']." ".$row['math'];
echo "<br>";
$mycon->close();
//mysqli_fetch_assoc()
// mysqli_fetch_array()
// mysqli_fetch_row()
// mysqli_fetch_field()
// mysqli_fetch_all()
?>
</tr>
</pre>
</center>
</body>
</html>
Tags: fetch_assoc() functionfetch_assoc() function in php mysqliPHPphp myslqi fetch association functionphp mysqli fetch_assoc() functionphp practicalphp program
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.