-
PHP Driven Blog?
I am looking into creating a PHP driven blog for my website. In all honesty i am not sure if what i am thinking is the right way to get this to happen but heres an explanation:
My website is run off a mysql database and phpmyadmin. I'd like to be able to log into phpmyadmin and add an entry to a table titled, 'blogs'. In the row i want to be able to set the title, the blog post, a time stamp, and an Author. Once that that entry is added i want the website to automatically update with the latest blog. This is where i get lost...
Where i am now i have a table that has a row or column for a title, a time stamp, a message and an author. My question is how do i call the respective items from my php table to be placed into the newly generated table on my main page?
Is this the right way to try and do something like this? or is there an easier way?
Thank you very much for any help.
-
-
You will need to loop through your blog entires from your MySQL table and then output them on to your page. I think what you are describing is going to work, of course there is more to it.
To display the most recent blog post, your MySQL query is going to be the key. Make sure each post has a unique numeric id that auto_increments. Your query will be $q = "SELECT ..... ORDER BY `unique_blog_id` DESC "; The ORDER BY DESC clause will return the last blog post first (largest blog_id number), thus when you loop through your blog posts, it will be output before the older ones.
And buy this book before you do anything else:
http://www.amazon.com/Practical-Web-...6224189&sr=8-1
It'll be a bit of a struggle to get up and running with this book, but you can use these forums when you get stuck. Once you are halfway through it though, your question and probably 100 more questions you haven't even thought of yet, will be answered.
Good luck!
Jason
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks