How to fetch data from existing table using PHP while I'm using XAMPP
Hi The_Big_k,
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:
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\learn\selectData.php on line 25
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 "And the Browser displayed the below error message
"; } mysql_free_result($result);
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\learn\selectData.php on line 25
Replies
-
Whats In NameThe warning you are getting shows that the query you tried to execute is facing some error and thus $result variable is storing FALSE and mysql_fetch_array() is getting a boolean as a parameter.To check for the error in query,use mysql_error() and tell us what browser displays.
-
Prasad AjinkyaI think your table might not have any rows, hence the boolean variable being returned (false).
Typically before running the mysql_fetch_array() method, always check with mysql_num_rows($result) > 0 condition. -
Manish GoyalThis error will only come if sql query is not proper
Is the table named Persons exists in DB?
You are reading an archived discussion.
Related Posts
RoboCop- A Robot which will behave like the original traffic police, that can detect any speeding car exceeding threshold speed, can detect the direction in which the speeding went, will...
hey... i am Fatma Amer from Egypt
i'm student at computers & system department at Faculty of Engineering at Minia University
i have 1 & half year to finish my...
It's most effortless video downloading method from Youtube :
Step :
- Open Terminal & Type
sudo apt-get install youtube-dl - Now open Youtube.com & copy the Video URL.
-...
Hello, Everyone I am a software engineer, I have done MCA and certification in Java, Php from Vskills Certification.
How can i benefit from this forum.
why surface roughness is greater in hot rolled parts than cold rolled parts..................@@@@@@@@@##########%%%%%%%%%%%%%%?%
answer as early as possible.....
FINAL exam question..........