PHP help:blogs
PostPosted: Sat Mar 26, 2005 4:59 pm
I'm extremely new to PHP, and so I've been using a tutorial to learn how to code my own blog. I've successfully created my database and table and can submit entries to my blog, but I can't display them....
Here's my code:
When I save and open the page, this is all it says:
Can someone tell me what I'm doing wrong or suggest an alternate method of making a blog for my website? That would be much appreciated ^_^
Here's my code:
<?php
mysql_connect ('******', '*****', '****') ;
mysql_select_db ('PHPdatabase');
$sql = "SELECT * FROM php_blog WHERE id=$id";
$result = mysql_query($sql) or
print ("Can't select entries from table php_blog.
" . $sql . "
" . mysql_error());
while ($row = mysql_fetch_array($result))
{
$date = date("l F d Y",$row["timestamp"]);
$title = $row["title"];
$entry = $row["entry"];
print "<b>$title</b>
";
print "$entry
";
print "posted on $date
";
}
?>
When I save and open the page, this is all it says:
" . $sql . "
" . mysql_error()); while ($row = mysql_fetch_array($result)) { $date = date("l F d Y",$row["timestamp"]); $title = $row["title"]; $entry = $row["entry"]; print "$title
\"; print "$entry
\"; print "posted on $date
\"; } ?>
Can someone tell me what I'm doing wrong or suggest an alternate method of making a blog for my website? That would be much appreciated ^_^