Jump to content

Wizpig

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Wizpig's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi! I'm working on a simple guide section, for practicing my MySQL/PHP. But now I'm kind of stuck. I've got two tables: guide_topics +----+-------+ | id | name | +----+-------+ | 1 | Car | +----+-------+ | 2 | Boat | +----+-------+ guides +----+----------+---------------------+-----------------------+ | id | topic_id | name | content | +----+----------+---------------------+-----------------------+ | 1 | 2 | How to drive a boat | Today we are going... | +----+----------+---------------------+-----------------------+ | 2 | 1 | How to drive a car | Today we are going... | +----+----------+---------------------+-----------------------+ Here's my question: How can i list up the the guides in the following waya?: -- Car -- * How to drive a car -- Boat -- * How to drive a boat I've comed so far: $res_topics = mysql_query("SELECT * FROM `guide_topics` ORDER BY `id` ASC"); while ($arr_topics = mysql_fetch_array($res_topics)) { $output .= " -- ".$arr_topics["name"]." --<br>"; } echo $output; die(); I've thought about JOINS, but I'm not good with using those in practice, so I hope maybe you guys got a solution to my problem. Thanks for all answers! - Wizpig
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.