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:
-
$query = "SELECT * FROM users ORDER BY id ASC";
-
Now, because we potentially have a long list of information, we can just spit it out on the screen, as that would be nearly impossible to sort through. So, we perform a 'while loop' to keep our data sort.
-
$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 />';
-
}
-
Here's what that would look like:
Id: 1
Username: jappleseed
Email:
jappleseed25@hotmail.com
END OF CURRENT USER INFORMATION
Id: 2
Username: HonestAbe
Email:
alincoln@gmail.com
END OF CURRENT USER INFORMATION
etc.