I have created a php page to retrieve data from a database. Now I want to display the data that I retried at a HTML page. How I can do that?
How to display data in a PHP variable at a HTML page?
Collapse
X
-
Tags: None
-
It depends on how you want to show your data.
Let's assume we have a database called 'users', and we want to pull and show ALL the data in that table. The 'users' table has 3 columns:
1) id
2) username
3) email
Our query would look like:
Code:$query = "SELECT * FROM users ORDER BY id ASC";
Code:$result = mysql_query($query); while ($row = mysql_fetch_assoc($result)){ print 'Id: ' . $row['id'] . '<br />'; print 'Username: ' . $row['username'] . '<br />'; print 'Email: ' . $row['email'] . '<br />'; print 'END OF CURRENT USER INFORMATION <br /><br />'; }
Id: 1
Username: jappleseed
Email: jappleseed25@ho tmail.com
END OF CURRENT USER INFORMATION
Id: 2
Username: HonestAbe
Email: alincoln@gmail. com
END OF CURRENT USER INFORMATION
etc.Comment
-
The codes you are given above is in a .php file. And we get the final out put in a .php file. But I need to know is how to transfer those outputs in to a .html file.Comment
-
Comment