Jump to content

Archived

This topic is now archived and is closed to further replies.

alcoholic1

Display all entrys in MYsql database on php page

Recommended Posts

im basically looking for a simply way to display every entry in the database in a table on the php page any one know a good way ?

Share this post


Link to post
Share on other sites
Have a read of [url=http://www.php-mysql-tutorial.com/php-mysql-select.php]this tutorial[/url] for getting data out of the database.

Share this post


Link to post
Share on other sites
First make a connection with the following code

[code]// Make a MySQL and database connection
mysql_connect("LOCALHOST","USERNAME","PASSWORD") or die(mysql_error());
mysql_select_db("TABLE") or die(mysql_error());[/code]

and edit the uppercase settings.

then use

[code]while($row = mysql_fetch_array( $result )) {
[/code]

then say you have a field called 'blah' and one called 'blah2'
you use the code
[code]echo $row['blah'];
echo $row['blah2'];[/code]


or you can even do something like
[code]  $blah = $row['blah'];
  $blah2 = $row['blah2'];[/code]

and use the new variables for the data. don't forget to close the while loop with another '}'

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.