Results 1 to 2 of 2

Thread: PHP Driven Blog?

  1. #1
    Join Date
    Oct 2008
    Posts
    23
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default 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.

  2. #2
    Join Date
    Apr 2008
    Location
    Limoges, France
    Posts
    395
    Thanks
    13
    Thanked 61 Times in 61 Posts

    Default

    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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •