Looking at my previous post, I think it assumed I was asking about
putting tables in the DB, but I want to view the content in an HTML
table on a webpage of data in the DB. I've searched several websites
and haven't found any snippets of code that seem to work. This seems
to be the most basic, but I'm not getting any results (and I have
some data in the DB).
Using the following code in table.php:
<html>
<head>
<title>Displaying MySQL Data</title>
</head>
<body>
<?
mysql_connect ("myhost","username","login");
mysql_select_db ("mydb");
$sql = "select * from mytable";
$result = mysql_query ($sql);
while ($row = mysql_fetch_array($result))
{
$field1= $row["name"];
$field2= $row["number"];
echo "$field1<br>";
echo "$field2<p>";
}
?>
</body>
</html>
When table.php is loaded in my webbrowser, nothing is on screen.
Here is my table syntax:
CREATE TABLE `table` (
`id` int(11) NOT NULL auto_increment,
`name` text,
`number` int(11) default NULL,
KEY `id` (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
Thanks,
Grant
[Non-text portions of this message have been removed]