Welcome Guest, Not a member yet? Register   Sign In
How to do this?
#12

[eluser]Mahn[/eluser]
Okay, here's a very simple example of what I'm trying to do written with procedural php. So the following code simple creates a list of categories, and the corresponding forums underneath (where the category_id = the one being displayed)

Code:
$query = mysql_query("SELECT * FROM categories");
while ($row = mysql_fetch_array($query))
{
echo '<ul>';
echo '<li>'.$row['category_name'].'</li>';
echo '</ul>';

$query = mysql_query("SELECT * FROM forums WHERE category_id = {$row['category_id']}");
while ($row = mysql_fetch_array($query))
{
  echo '<ol>';
  echo '<li>'.$row['forum_name'].'</li>';
  echo '</ol>';
}
}

Which will make something like the following:

Code:
• Category 1
1. I belong to category 1
2. I also belong to category 1

• Category 2
1. I belong to category 2
2. I also belong to category 2


Messages In This Thread
How to do this? - by El Forum - 07-26-2012, 03:15 PM
How to do this? - by El Forum - 07-26-2012, 09:26 PM
How to do this? - by El Forum - 07-27-2012, 06:42 AM
How to do this? - by El Forum - 07-27-2012, 11:44 AM
How to do this? - by El Forum - 07-27-2012, 06:45 PM
How to do this? - by El Forum - 07-27-2012, 09:22 PM
How to do this? - by El Forum - 07-28-2012, 04:14 AM
How to do this? - by El Forum - 07-28-2012, 04:18 AM
How to do this? - by El Forum - 07-28-2012, 04:34 AM
How to do this? - by El Forum - 07-28-2012, 04:42 AM
How to do this? - by El Forum - 07-28-2012, 09:34 AM
How to do this? - by El Forum - 07-29-2012, 04:20 PM
How to do this? - by El Forum - 07-30-2012, 04:17 PM
How to do this? - by El Forum - 07-30-2012, 05:31 PM
How to do this? - by El Forum - 07-31-2012, 04:15 AM
How to do this? - by El Forum - 07-31-2012, 11:15 AM



Theme © iAndrew 2016 - Forum software by © MyBB