locked
Create a php for sql database RRS feed

  • Question

  • Write a PhP script that accesses the database and displays the messages in reverse
    chronological order, properly indenting up to two levels of follow-up messages. for the bulletin board system.

    Figure 1: Database State Table = bbusers

    email name password nickname
    a@abc.com Andy Smith a123 baggy
    b@abc.com Craig Smith a123 runner
    c@abc.com Craig Rich a123 slogger
    d@abc.com Mike Arlott a123 ateam

     

    Figure 2:Posting Table

     postId postDate postedBy postSubject content parentPost
    1 11/01/03 10:15 a@abc.com Welcome Welcome to the bulletin board NULL
    2 12/01/03 08:00 b@abc.com Welcome 2 This is posting 2 1
    3 13/01/03 09:00 c@abc.com Welcome 3 This is posting 3 1
    4 14/01/03 09:00 a@abc.com New topic This is posting 4 NULL
    5 15/01/03 09:00 a@abc.com New topic 2 This is posting 5 4
    6 16/01/03 09:00 a@abc.com New topic 3 This is posting 6 4
    7 17/01/03 09:00 c@abc.com Welcome 4 This is posting 7 2
    8 18/01/03 09:00 d@abc.com Welcome 5 This is posting 8 2
    9 19/01/03 09:00 a@abc.com Welcome 6 This is posting 9 8
    10 20/01/03 09:00 b@abc.com New topic 4 This is posting 10 6

    Monday, May 16, 2011 6:19 AM

Answers

  • About a month or so ago there was a very similar question in Transact-SQL forum. There is nothing too complex in regards to a query, we just need to construct a proper ORDER BY CLAUSE. (First go records where ParentPost = NULL and then records where it's not NULL sorted in descending ORDER BY date).

    As for the PHP forum, here is another one

    http://tek-tips.com/threadminder.cfm?pid=434


    For every expert, there is an equal and opposite expert. - Becker's Law


    My blog
    • Proposed as answer by Stephanie Lv Wednesday, May 18, 2011 1:26 AM
    • Marked as answer by Stephanie Lv Tuesday, May 24, 2011 12:00 AM
    Monday, May 16, 2011 8:26 PM

All replies

  • I think you will be better of asking that question on PHP forum
    Best Regards, Uri Dimant SQL Server MVP http://dimantdatabasesolutions.blogspot.com/ http://sqlblog.com/blogs/uri_dimant/
    Monday, May 16, 2011 6:28 AM
    Answerer
  • Sounds like a University assignment question :-)
    Jeff Wharton MSysDev (C.Sturt), MDbDsgnMgt (C.Sturt) MCT, MCPD, MCITP, MCDBA, MCSD, MCAD
    Monday, May 16, 2011 6:33 AM
  • i have done most of the php in terms of layout. i dont know what to put in the query section.

    any suggestions for a php forum that can help will be appreaciated!

    many thanks!!!

    Monday, May 16, 2011 6:44 AM
  • www.phpforumscript.com/

    http://www.phpbb.com/


    Best Regards, Uri Dimant SQL Server MVP http://dimantdatabasesolutions.blogspot.com/ http://sqlblog.com/blogs/uri_dimant/
    Monday, May 16, 2011 6:52 AM
    Answerer
  • Monday, May 16, 2011 7:57 PM
  • About a month or so ago there was a very similar question in Transact-SQL forum. There is nothing too complex in regards to a query, we just need to construct a proper ORDER BY CLAUSE. (First go records where ParentPost = NULL and then records where it's not NULL sorted in descending ORDER BY date).

    As for the PHP forum, here is another one

    http://tek-tips.com/threadminder.cfm?pid=434


    For every expert, there is an equal and opposite expert. - Becker's Law


    My blog
    • Proposed as answer by Stephanie Lv Wednesday, May 18, 2011 1:26 AM
    • Marked as answer by Stephanie Lv Tuesday, May 24, 2011 12:00 AM
    Monday, May 16, 2011 8:26 PM