I’ve been writing a small blogging system to advance my knowledge of PHP, and I’m having fun writing it. I’ve been using one page, coupled with jquery’s pajinate plugin to display all my blog entries through one page. However, my question here is can I generate a page which displays a blog article with the id of 2?
What I want to do is generate the article, but dump it to a page (content/article-name-here.php). Is there any way of automating the process?
(Sorry if it’s not clear)
Here’s a basic SQL query:
(Note: Never use SELECT * unless you’re actually using all the data)
I have done the same project as you, creating a simple blogging engine, and I use the same page for both the general list and the single article.
Using a URL such as
example.com/?blogId=2you can modify your query:If you want custom URLs for each blog entry, you will want to look in to Mod_Rewrite:
http://www.workingwith.me.uk/articles/scripting/mod_rewrite