Basically I first query specific columns from a mysql table and want to echo them all using foreach() in php. Here is my code.
$sql = "SELECT id, name, roll_no, email, title, abstract, supervisor, sub_date
FROM student_data";
$result = $conn->query($sql);
$array = $result->fetch_assoc();
foreach ($array as $x => $value)
{
echo $array["id"] . " " . $array["name"] . " " . $array["roll_no"] . " " . $array["title"] . " " . $array["supervisor"] . " " . $array["sub_date"] ."<br><br>";
}
It simply keeps repeating the first entry.