我该如何显示
category1
id
title
category2
id
title
但直到现在只有我可以显示的是所有这些按类别排序。我的代码:
$query = mysql_query("select * from article where user_id = '$userId' order by category,date desc") ;
while( $row = mysql_fetch_assoc( $query )) {
$id=$row['id'];
$trimstring = substr($row['body'], 0, 100) ;
$varCategory = NULL;
?>
<div class="container" id = "articles">
<h1><a href="index.php?page=articol&id=<?php echo $id;?>"><?php echo $row['title'];?></a></h1>
<p> <?php echo $trimstring; ?> </p>
<p id = "date"> <?php echo $row['date']; ?> </p>
</div>
<?php
}