I successfully created a MySQL + PHP script that adds news items.
<?
$db=mysql_connect ("localhost", "USERNAME_HERE", "PASSWORD_HERE") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("MY_DATABASE_HERE",$db);
if ($id) {
// editing so select a record
$sql = "SELECT * FROM news WHERE id=$id";
$result = mysql_query($sql);
$myrow = mysql_fetch_array($result);
$id = $myrow["id"];
}
$result = mysql_query("SELECT * FROM news",$db);
while ($myrow = mysql_fetch_array($result)) {
printf("<br>");
printf("<font size=6><b>%s</b></font><br>\n", $myrow["topic"]);
printf("<font size=2><b>Posted by: %s</b></font><br><br>\n", $myrow["name"]);
printf("%s<br>\n", $myrow["content"]);
printf("<font size=3><b>%s</b></font><br>\n", $myrow["comment_title"]);
printf("- <a href=comment_script.php?id=%s target=_blank><font size=2>Add Comment</font></a><-- DOESNT WORK YET!<br>\n", $myrow["id"]);
}
?>
At the moment this script just displays the news, but it wont add the comments. If I made a different database, how would I put both the news and a new database together to display new ones. Like if it displays 1 news item, how will it display all the comments in 1 news item? I need some huge help here, I am close to complete noob. I just know a few simple things.