Page 1 of 1

Simple Blog[Resolved]

Posted: Wed Jul 13, 2011 1:29 pm
by Nexus
I am working on a blog and it will have 2 files, blogread.php and blogpost.php, I have a table in the database named accordingly

blog post

the fields are
id
author
title
content
date_posted

I use a simple method of retrieval from the database in blogread.php but I have a problem as it won't query $bloginfo2

blogread.php

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<link rel="stylesheet" href="style.css" type="text/css" />
<?php
include_once('connect.php');
$bloginfo="SELECT * FROM blog post ORDER BY date_posted";
$bloginfo2=mysql_query($bloginfo) or die("Could not query blog info");
$bloginfo3=mysql_fetch_array($bloginfo2);
$blogdate=mysql_num_rows($bloginfo2);
?>
<div id="bloghead" align="center">
<?php
echo "<b>'bloginfo3[title]'</b><br/>";
echo "<i>'$bloginfo3[author]'</i><br/>";
echo "'$blogdate[date_posted]'<br/>";
?>
</div>
<div id="blogcontent" align="center">
<?php 
echo "'$bloginfo3[content]'";
?>
<body>
</body>
</html>
I don't have blogpost.php done yet

Re: Simple Blog

Posted: Wed Jul 13, 2011 6:13 pm
by Torniquet
do

or die(mysql_error());

should tell you why its failing on you

Re: Simple Blog

Posted: Wed Jul 13, 2011 6:46 pm
by Nexus
Thanks torn! I realized it doesn't read tables with spaces, so I had to just put an _ underscore :)

Re: Simple Blog

Posted: Wed Jul 13, 2011 8:12 pm
by Torniquet
glad ya got it fixed mate :)

Re: Simple Blog

Posted: Wed Jul 13, 2011 9:29 pm
by Jackolantern
Glad you got it fixed :) If you could mark this as [resolved] in the title! Thanks :)