Kineas
11-06-2009, 08:10 PM
I've made an RSS feed for my blog, and when I click on the title of a blog, I want it to take the user to a page to view that blog entry. Anyway, I've done this by having the blog id in the hyperlink, so when clicking on the link, it takes you to www.abc.com/blog.php?blog=1. The mysql database containing my blog entries has id, title, and message. So far, I've got this:
$dbServer=@mysql_connect("localhost","","");
if (!$dbServer) {echo "Failed to connect to MySQL"; exit; }
mysql_select_db("");
if($_GET['blog']){
$sql ="SELECT * FROM messages";
$sql.=" WHERE id LIKE '%".mysql_real_escape_string($_GET["blog"])."%'";
$queryResult=mysql_query($sql);
echo $dbRecord['title'];
}else
{
}
I'm not sure if my syntax is right to get the data from the database as nothing is showing when this is run. Any help with this would be great, thanks.
$dbServer=@mysql_connect("localhost","","");
if (!$dbServer) {echo "Failed to connect to MySQL"; exit; }
mysql_select_db("");
if($_GET['blog']){
$sql ="SELECT * FROM messages";
$sql.=" WHERE id LIKE '%".mysql_real_escape_string($_GET["blog"])."%'";
$queryResult=mysql_query($sql);
echo $dbRecord['title'];
}else
{
}
I'm not sure if my syntax is right to get the data from the database as nothing is showing when this is run. Any help with this would be great, thanks.