In latest two posts I have shown you how to connect to a mysql database via PHP, and in another one I teach you how to select rows from a mysql database table. In this one I will show you how to extract that rows from mysql and print them out into a page. Let’s suppose we have a database which contains fields : id, full_name, age. Ok, next step is connecting to db, then making a query to select those fields and finally extract & print them on the screen :
$query_db = "select * from table_Name";
$result_db = mysql_query($query_db);
print "$row->full_name it's $row->age years old";
We used a while() loop to extract all results!
Isn’t PHP rocking?