高分解难题:PHP查询MYSQL数据,记录集如何特殊显示!
MYSQL 有个商品价格统计表,如图:
用PHP查询某商品,显示在网页上,查询结果如下:
难点就是如何按照年份、月份显示!难死小弟了,跪求操作语句!
------解决方案--------------------
................
$result=<a style="color:#f60; text-decoration:underline;" title="mysql" href="https://www.php.cn/zt/15713.html" target="_blank">mysql</a>_query("select year(addtime) as y,group_concat(jiage) as str from table_name group by year(addtime);");
while($row=mysql_fetch_assoc($result)){
echo '<tr>';
echo "<td>$row[y]</td>";
foreach(explode(',',$row[str]) as $v)
echo "<td>$v</td>;
echo '</tr>';
}
............
<br><font color="#e78608">------解决方案--------------------</font><br>
$result=mysql_query("select year(add_date) as y,group_concat(yc_jiage) as str from jiagedata group by year(add_date);") or die(mysql_error());<br><br>贴出提示。
<br><font color="#e78608">------解决方案--------------------</font><br>执行#12楼后提示什么信息。 <div class="clear"></div>
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号