首先我登录mysql,输入命令如下
mysql> SELECT tid,subject FROM pre_forum_thread WHERE author='hikego' order by dateline desc limit 10;
+-----+----------+
| tid | subject |
+-----+----------+
| 395 | ???????? |
| 2 | ????? |
| 1 | ?? |
查询输出一共只有三个记录,我运行test2.php,代码如下
<?php
require './source/class/class_core.php';
C::app()->init();
$query = DB::query("SELECT tid,subject FROM ".DB::table('forum_thread')." WHERE author='hikego' order by dateline desc limit 10");
while($thread = DB::fetch($query)) {
echo '<a href="forum.php?mod=viewthread&tid='.$thread[tid].'" target="_blank">'.$thread[subject].'</a><br>';
}
?>
test2.php的输出有七、八条,为什么两边不对称,我看了良久,我觉得语句没有问题啊!
|