SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Guru Ize's Avatar
    Join Date
    Nov 2005
    Location
    The Netherlands
    Posts
    808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    output a nice list of Q and A in the right order (was "MySQL newbie question")

    Hi,

    I'm working on a CMS for a FAQ-page.
    Since there can be unlimited questions/answers added by the administrator, I guess I'll have to use some sort of join in order to link questions and answers together.

    I now have two tables, questions and answers respectively, looking like this:
    Code:
    questions
    ---------
    id INT NOT NULL AUTO_INCREMENT PRIMARY KEY
    text TEXT
    
    answers
    -------
    id INT NOT NULL AUTO_INCREMENT PRIMARY KEY
    text TEXT
    I'm afraid this isn't the right approach, but I'm really not very familiar with joins.
    How can I output a nice list of Q and A in the right order?

  2. #2
    SitePoint Guru Ize's Avatar
    Join Date
    Nov 2005
    Location
    The Netherlands
    Posts
    808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    By the way, phpinfo() says the following:
    "Client API version 3.23.49"

  3. #3
    Twitter - @CarlBeckel busy's Avatar
    Join Date
    May 2004
    Location
    Richmond, VA, USA
    Posts
    819
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Will each question only have one answer, and each answer only have one question?

    If this is true, why not just use one table?

  4. #4
    SitePoint Guru Ize's Avatar
    Join Date
    Nov 2005
    Location
    The Netherlands
    Posts
    808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by busy
    Will each question only have one answer, and each answer only have one question?

    If this is true, why not just use one table?
    Yes, each question will have one answer and vice versa.
    Hm, you're right...
    Damn, where did my mind wander off to? The whole afternoon I've been Googling for JOIN references...

  5. #5
    SitePoint Wizard guelphdad's Avatar
    Join Date
    Oct 2003
    Location
    St. Catharines, ON Canada
    Posts
    1,707
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Please choose more appropriate thread titles when you post here in future. If everyone chose titles such as "MySQL newbie question" it would make the discussion board useless for everyone.

    Also you should consider upgrading your version of mysql. Yours is seriously out of date. MySQL offers upgrades to their product about every month or so. Your version is more than 3 years old. You will be very limited in what you can do with that version of mysql.

    as to joins etc. check the articles on this site under php/mysql I believe there are ones that explain joins.

  6. #6
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    Join Date
    Feb 2004
    Location
    Tampa, FL (US)
    Posts
    9,854
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Ize
    By the way, phpinfo() says the following:
    "Client API version 3.23.49"
    that's not the mysql server version. that is the version of the client built in to php.

  7. #7
    Twitter - @CarlBeckel busy's Avatar
    Join Date
    May 2004
    Location
    Richmond, VA, USA
    Posts
    819
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you want to make that current, you can download the correct one from here. Explanations are on the page as well.

    http://dev.mysql.com/downloads/connector/php/


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
  •