O
old.Pac
Guest
Copy and past this code to view a database:
<?php
// Set the variables for the database access:
$Host = "freesql.org";
$User = "Username";
$Password = "Password";
$DBName= "DBName";
$TableName = "TableName";
// Connects to the database
$Link = mysql_connect ($Host, $User, $Password);
$Query = "select * from $TableName";
$Result = mysql_db_query ($DBName, $Query, $Link);
// Create a HTML Table on your page
// You can add as many files as you like.
print ("<table border=0 cellpadding=3 cellspacing=1 width=\"75%\" align=center>\n");
print ("<tr align=center valign=top>\n");
print ("<td align=center valign=top>Name</td>\n");
print ("<td align=center valign=top>Email Address</td>\n");
print ("<td align=center valign=top>Comments</td>\n");
print ("</tr>\n");
// Fetch the results from the database
while ($Row = mysql_fetch_array
($Result)) {
print ("<tr align=center valign=top>\n");
print ("<td align=center valign=top>$Row[FirstName] $Row[LastName]</td>\n");
print ("<td align=center valign=top>$Row[EmailAddress]</td>\n");
print ("<td align=center valign=top>$Row[Comments]</td>\n");
print ("</tr>\n");
}
mysql_close ($Link);
print ("</table>\n");
?>
<?php
// Set the variables for the database access:
$Host = "freesql.org";
$User = "Username";
$Password = "Password";
$DBName= "DBName";
$TableName = "TableName";
// Connects to the database
$Link = mysql_connect ($Host, $User, $Password);
$Query = "select * from $TableName";
$Result = mysql_db_query ($DBName, $Query, $Link);
// Create a HTML Table on your page
// You can add as many files as you like.
print ("<table border=0 cellpadding=3 cellspacing=1 width=\"75%\" align=center>\n");
print ("<tr align=center valign=top>\n");
print ("<td align=center valign=top>Name</td>\n");
print ("<td align=center valign=top>Email Address</td>\n");
print ("<td align=center valign=top>Comments</td>\n");
print ("</tr>\n");
// Fetch the results from the database
while ($Row = mysql_fetch_array
($Result)) {
print ("<tr align=center valign=top>\n");
print ("<td align=center valign=top>$Row[FirstName] $Row[LastName]</td>\n");
print ("<td align=center valign=top>$Row[EmailAddress]</td>\n");
print ("<td align=center valign=top>$Row[Comments]</td>\n");
print ("</tr>\n");
}
mysql_close ($Link);
print ("</table>\n");
?>