Here is another example although ~Jim_Westergren's code should work fine. Replace the connection and table variables with your own.
viewall.php
PHP Code:
<html>
<head><title>Your Page Title</title></head>
<body>
<?php
$database="yourdbname";
mysql_connect ("localhost", "yourusername", "yourpassword");
@mysql_select_db($database) or die( "Unable to select database");
$result = mysql_query( "SELECT * FROM yourtable" )
or die("SELECT Error: ".mysql_error());
$num_rows = mysql_num_rows($result);
print "There are $num_rows records.<P>";
print "<table width=400 border=1>\n";
while ($get_info = mysql_fetch_row($result)){
print "<tr>\n";
foreach ($get_info as $field)
print "\t<td><font face=arial size=1/>$field</font></td>\n";
print "</tr>\n";
}
print "</table>\n";
?>
</body>
</html>
viewcertainfields.php
PHP Code:
<html>
<head><title>Your Page Title</title></head>
<body>
<?php
$database="yourdbname";
mysql_connect ("localhost", "yourusername", "yourpassword");
@mysql_select_db($database) or die( "Unable to select database");
$result = mysql_query( "SELECT field1, field2, field3 FROM yourtable" )
or die("SELECT Error: ".mysql_error());
$num_rows = mysql_num_rows($result);
print "There are $num_rows records.<P>";
print "<table width=200 border=1>\n";
while ($get_info = mysql_fetch_row($result)){
print "<tr>\n";
foreach ($get_info as $field)
print "\t<td><font face=arial size=1/>$field</font></td>\n";
print "</tr>\n";
}
print "</table>\n";
?>
</body>
</html>
You can also add limit and order to the query...
