Hi Guys!
I have a category name and a post_title in different table. i fetch all category and the post_title in my index let say my category name is "sport" then my post_title is all about sport now proceed to the code i used the query of inner join for the two table.
my problem is every time i make a topic with category the result is like this..
SPORT
nba 2011
SPORT
nba 2010
MOVIE
Iron Man 2
MOVIE
Iron Man 1
but I want to make it like this :
SPORT
nba 2011
nba 2010
MOVIE
Iron Man 2
Iron Man 1
Any ideas how to do this?
This is my code
$sql = "SELECT
`blog_category`.`id`,
`blog_category`.`cat_name`,
`posts`.`post_title`
FROM `blog_category`
INNER JOIN (`posts`)
ON `blog_category`.`id`=`posts`.`post_category_id`";
$rows = mysql_query($sql);
while ($data = mysql_fetch_assoc($rows)){
echo "$data[cat_name]<br>";
echo "$data[post_title]<br>";
}