[FONT=arial]
thanks so much you guys. all of you have been a great help. i finally got it to work. here is the final code (by the way, none of the error reporting stuff actually shows. i think that geocities turned it off. they do provide a log file that show errors. once i read what you all had to say i understood what the log file was telling me):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<title>Retrieving Data from a Database</title>
<meta name="Generator" content="TextPad 4.0">
<meta name="Author" content="Ange Spring">
<meta name="Keywords" content="php trial">
<meta name="Description" content="this is a page to discover my php talents. it is from the php book, p198">
</head>
<body>
<?php
error_reporting(E_ALL);
$host="mysql";
$user="xxxxxxx";
$password="xxxxxxx";
$dbName="trial";
$tableName="joesauto";
$link=mysql_connect($host, $user, $password) or die (mysql_error());
mysql_select_db($dbName);
$query="SELECT * from $tableName";
print("here is the query: ");
print("$query");
print("<br>\n");
//$result=mysql_select_db($query);
$result=mysql_query($query);
//print("here is the result: ");
//print("$result");
if (!$link) {
print("Unable to connect to the " . "database server at this time.</P>\n" );
exit(); }
//create a table
print("<TABLE BORDER=1 WIDTH=600 CELLSPACING=2 CELLPADDING=2 ALIGN=CENTER>\n");
print("<TR ALIGN=CENTER VALIGN=TOP>\n");
print("<TD ALIGN=CENTER VALIGN=TOP>Year</TD>\n");
print("<TD ALIGN=CENTER VALIGN=TOP>Make</TD>\n");
print("<TD ALIGN=CENTER VALIGN=TOP>Model</TD>\n");
print("<TD ALIGN=CENTER VALIGN=TOP>Price</TD>\n");
print("<TD ALIGN=CENTER VALIGN=TOP>Picture Name</TD>\n");
print("</TR>\n");
//Fetch the results from the database.
//while ($Row = mysql_fetch_array ($result, 'MYSQL_FETCH_ASSOC')) {
while ($Row = mysql_fetch_array ($result)) {
print("<TR ALIGN=CENTER VALIGN=TOP>\n");
print("<TD ALIGN=CENTER VALIGN=TOP>$Row[year]</TD>\n");
print("<TD ALIGN=CENTER VALIGN=TOP>$Row[make]</TD>\n");
print("<TD ALIGN=CENTER VALIGN=TOP>$Row[model]</TD>\n");
print("<TD ALIGN=CENTER VALIGN=TOP>$Row[price]</TD>\n");
print("<TD ALIGN=CENTER VALIGN=TOP><img src=\"$Row[picture_name]\" alt=$Row[picture_name] height= 120 width=160></TD>\n");
print("</TR>\n");
}
mysql_close($link);
print("</TABLE>\n");
?>
</body>
</html>
[/COLOR]
By the way I'm a good ole' Canadian chick, but no harm done. I suppose most people on here are guys.😃
By the way, how do you cut and paste code that has color into this forum and make it show the colors. I am assuming that you did not add it in all yourself. That would be too time consuming.
[/FONT]