This question already has an answer here:
// I'm just testing out to display data from database but i keep getting this error :( anyone help?
<?php
include 'Connect.php';
?>
<?php
//query the database
$query = mysql_query("SELECT * FROM people ");
mysql_select_db("roofandfacade");
//fetch the results/convert results into array
While ($rows= mysql_fetch_array($query)) {
echo $rows['Person_Name'];
}
?>
</div>
Looks like you are selecting your database after running your query. That won't work for what I hope is obvious reasons.
$query = mysql_query("SELECT * FROM people ");
mysql_select_db("roofandfacade");
Reverse that:
mysql_select_db("roofandfacade");
$query = mysql_query("SELECT * FROM people ");
I am not sure why you don't have mysql_select_db("roofandfacade");
in your connect.php
file with your call to mysql_connect()
. That would be a more logical place to put it.