Jump to content


Display all entrys in MYsql database on php page

  • Please log in to reply
2 replies to this topic

#1 alcoholic1

  • Members
  • Pip
  • Newbie
  • 7 posts

Posted 04 July 2006 - 03:18 PM

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 ?

#2 wildteen88

  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 04 July 2006 - 04:49 PM

Have a read of this tutorial for getting data out of the database.

#3 Dville

  • Members
  • PipPipPip
  • Advanced Member
  • 88 posts

Posted 04 July 2006 - 06:11 PM

First make a connection with the following code

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

and edit the uppercase settings.

then use

while($row = mysql_fetch_array( $result )) {

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

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

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

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users