I have just started learning php and i am trying to set up connection to local mysql db I have pasted the code that i am trying to run.
I am getting $result = false and i reach else part --" No return" In the image attached , there is a table called "table" under db test, and i have 3-4 entries as well
Can someone take time to help me understand whats going wrong here ?
thank you !!
<!doctype html>
<html>
<head>
</head>
<body>
<?php
$link = mysqli_connect('localhost','root','','test');
$query = "select * from 'table' " ;
$outputDisplay = "";
$myrowcount = 0;
if (!$link)
{
die('Could not connect to MySQL: ' . mysqli_error());
} else
{
echo 'Connection OK';
print ($query);
$result = mysqli_query($link, $query);
if($result)
{
$numresults = mysqli_num_rows($result);
printf("Select returned %d rows.
", $numresults);
}
else
{
echo "No return";
}
mysqli_close($link);
}
?>
</body>
</html>