I have created 'hello' database using phpMyAdmin and student table. Now following code is not working, despite being completely true.
<?php
$conn=mysqli_connect('localhost','divyang','','hello');
$a=mysql_select_db('hello',$conn);
echo "<br>";
if (!$a) {
die('Could not connect: ' . mysql_error());
}
$query="SELECT * FROM `student`";
$result=mysqli_query($query,$conn);
while($row=mysqli_fetch_array($result)){
echo "".$row["name"]." ".$row["surname"]."<br>";
}
?>
This code just gives 'could not connect' answer. It gives nothing other in return.