Simple Blog[Resolved]

Place for questions and answers for all newcomers and new coders. This is a free for all forum, no question is too stupid and to noob.
Post Reply
User avatar
Nexus
Posts: 293
Joined: Sat Jun 18, 2011 10:42 pm

Simple Blog[Resolved]

Post 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
Last edited by Nexus on Wed Jul 13, 2011 10:12 pm, edited 1 time in total.
User avatar
Torniquet
Posts: 869
Joined: Sun Aug 02, 2009 6:18 am

Re: Simple Blog

Post by Torniquet »

do

or die(mysql_error());

should tell you why its failing on you
New Site Coming Soon! Stay tuned :D
User avatar
Nexus
Posts: 293
Joined: Sat Jun 18, 2011 10:42 pm

Re: Simple Blog

Post by Nexus »

Thanks torn! I realized it doesn't read tables with spaces, so I had to just put an _ underscore :)
User avatar
Torniquet
Posts: 869
Joined: Sun Aug 02, 2009 6:18 am

Re: Simple Blog

Post by Torniquet »

glad ya got it fixed mate :)
New Site Coming Soon! Stay tuned :D
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Simple Blog

Post by Jackolantern »

Glad you got it fixed :) If you could mark this as [resolved] in the title! Thanks :)
The indelible lord of tl;dr
Post Reply

Return to “Beginner Help and Support”