I was trying to connect to my database through PHP but I keep getting the error:
Warning: mysql_fetch_array() expects parameter 1 to be resource
I do not know what the problem is?
This is the code I have:
<?php //Connect to the server $connect = mysql_connect("localhost","root",""); //Connect to the database mysql_select_db("firstdatab"); $query = mysql_query("SELECT * FROM users WHERE FavNumber = '44' "); //Get Results $rows = mysql_fetch_array($query); $first_name = $rows['Name']; echo "$first_name"; ?>
Can someone tell me what is wrong?