问题未解决,接着提问!关于查询结果特殊显示的问题!
原帖:http://topic.csdn.net/u/20120214/16/171276bf-16a7-45a3-8224-fea338db7ee0.html?1686623126
这个帖子不能再回复了,另开一贴:
数据库结构、字段如下图:
要想达到这样的显示效果:
论坛上 jordan102 朋友帮忙写了个查询过程,PHP文件代码如下:
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--><?php
mysql_connect('127.0.0.1','root','');
mysql_select_db('jiagedata');
$result=mysql_query("select year(add_date) as y,group_concat(yc_jiage) as str from yc_jiage group by year(add_date);") or die(mysql_error());
echo '<table>';
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>";
}
echo "</table>";
?>
while($row=<a style="color:#f60; text-decoration:underline;" title="mysql" href="https://www.php.cn/zt/15713.html" target="_blank">mysql</a>_fetch_assoc($result)){
$arr[$row[y]]=$row;
}
foreach($arr as $k=>$v){
$s_arr=explode(',',$v[str]);$n_arr=explode(',',$v[ss]);
foreach($n_arr as $k1=>$n)
$tmp[$k][$n]=$s_arr[$k1];
}
echo '| 年\月 | "; for($i=1;$i{$i}月"; echo "
| '.$k2.' | '; for($i=1;$i$v[$i]"; } echo '
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号