How to fetch data from existing table using PHP while I'm using XAMPP

Hi All,

I'm fresher in PHP and I want to learn PHP very well..............Please help.........

I'm facing problem to fetch data from my existing table using below code:

mysql_select_db("my_db",$con);

$result = mysql_query("SELECT * FROM Persons");


while($row = mysql_fetch_array($result))
{
echo $row['FirstName'] . " " . $row['LastName'];
echo "
";
}

mysql_free_result($result);


And the Browser displayed the below error message


Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\learn\selectData.php on line 25

Replies

You are reading an archived discussion.

Related Posts

What is SOCKET in TCPIP ? Can anyone explain with real examples ?
General Electric (GE) has launched industrial internet that helps predict and prevent electrical grid outages. The system connects with all the existing system components including grid power equipment, sensors and...
When a six legged robot and a six rotor robot helicopter are mated, one would expect sparks to fly. This one walks, dances a jive, flies and grabs things on...
The world is gradually moving towards 'thinner' electronics and electronic circuits are now making their way to the paper. So the next time you hand over your business card -...
A 50 KW Plug and play wind turbine that goes into a standard 40' container is a path breaking innovation. https://upriseenergy.com/50kw-portable-power-center