mysqlを使用するphpで、2つの列の値を1回だけ出力してから、他の値をループする方法を教えてください。
ここ:
$exe_fetch_data = mysql_query("select category, subcategory, title, body, views from table");
while($row = mysql_fetch_array($exe_fetch_data))
echo $row['category']; //Only once
echo $row['subcategory']; //Only once
{
echo $row['title'];
echo $row['body'];
echo $row['views'];
}
必要な出力:
Category->SubCategory //Outputted only once
Title, //Title Body and Views depend on whatever's there in the db. Could be 10 or more
Body,
Views
Title,
Body,
Views
Title,
Body,
Views