Wow... so much wrong... :-)
*Thank you soooooo much for your help!
Ok, so I was following this manual: http://www.freewebmasterhelp.com/tutorials/phpmysql/3 which was most likely the problem. So I switched to this:
<?php
// CONNECTION TO THE MYSQL DATABASE
$hostname = "localhost"; // change to your hostname
$db_user = "root"; // change to your database username
$db_password = ""; // change to your database password
$database = "internet1"; // provide your database name
$db_table = "comments"; // leave this as is
// THIS CODE IS USED TO CONNECT TO THE MYSQL DATABASE
$db = mysql_connect($hostname, $db_user, $db_password);
mysql_select_db($database,$db);
?>
<html>
<head>
<title>ADD COMMENTS</title>
</head>
<body>
<?php
if (isset($REQUEST['Submit'])) {
// THIS CODE TELL MYSQL TO INSERT THE DATA FROM THE FORM INTO YOUR MYSQL TABLE
$sql = "INSERT INTO $db_table(date,comment) values ('".mysql_real_escape_string(stripslashes($REQUEST['date']))."','".mysql_real_escape_string(stripslashes($_REQUEST['comment']))."')";
if($result = mysql_query($sql ,$db)) {
echo 'Thank you. Your comment has been added.';
} else {
echo "ERROR: ".mysql_error();
}
} else {
?>
<h1>Add a comment here:</h1>
<form method="post" action="">
Date (MM.DD.YY):<br>
<input type="text" name="date">
<br>
Comment: <br>
<input type="text" name="comment">
<br><br>
<input type="submit" name="Submit" value="Submit">
</form>
<?php
}
?>
</body>
</html>
And now its working like a charm. Now the issue is, how to export the data saved onto a table in HTML. So for that, I have used this manual: http://www.phpbuilder.com/board/archive/index.php/t-10207538.html
But the following code is not working:
<?php
$hostname = "localhost"; // change to your hostname
$db_user = "root"; // change to your database username
$db_password = ""; // change to your database password
$database = "internet1"; // provide your database name
$db_table = "comments"; // leave this as is
mysql_connect($hostname, $db_user, $db_password)
mysql_select_db($database);
print "<TABLE BORDER=0 CELLPADDING=2>\n";
$fields = mysql_list_fields($database, $db_table);
$columns = mysql_num_fields($fields);
print "<TR>";
for ($x = 0; $x < $columns;$x++) {
print "<TH>" . mysql_field_name($fields,$x) . "</TH>\n";
}
print "</TR>\n";
$sql = "SELECT * from YOURSQLTABLENAME";
$result = mysql_query($sql);
while ($obj = mysql_fetch_object($result,MYSQL_ASSOC)) {
print "<TR>";
foreach($obj as $val) {
print "<TD>" . $val . "</TD>";
}
print "</TR>\n";
}
echo "</TABLE>\n";
?>
Any help would be appreciated. Thanks again for your above comment.