在使用 mysql 的 php 中,我怎样才能只输出两列值一次,然后循环通过其他列值。
这里:
$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