Hello everyone,
I have a problem with this code

php:

<?php
$sql = mysql_query("select * from news left join categories on news.category_id = categories.id group by category order by categories.id ");
while($row=mysql_fetch_array($sql)){
?>

html:

<div class="title" align="center">
<?=$row['category']?>
</div>
<div class="headlines">
<span style="float:left;"><?=$row['subject']?></span>
<span style="float:right;"> <?=$row['date']?> </span>
</div>

the problem is when i fetch array from news and categories table
i get each category has one headline
what i want to do is to include more than one news in each category

if you want more information please tell me

Your GROUP BY is causing this, Try removing it and using the `category` in the ORDER BY before the `id`.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.