这样的哦 昨天没说清楚
在mysql交互方式下
代码:
mysql>use phpmod; mysql>select topic_id,forum_id,topic_title from phpbb_topics where forum_id=2 order by topic_id desc limit 2;
可以显示如下: 引用:
+----------+----------+-------------+ | topic_id | forum_id | topic_title | +----------+----------+-------------+ | 4 | 2 | 测试3 | | 3 | 2 | 测试2 | +----------+----------+-------------+ 2 rows in set (0.03 sec)
我写了一个test.php
代码:
<?php $dbms = 'mysql4'; $dbhost = 'localhost'; $dbname = 'phpmod'; $dbuser = 'root'; $dbpasswd = '123456'; //密码:) $table_prefix = 'phpbb_';
define('PHPBB_INSTALLED', true);
$query = "select topic_id,forum_id,topic_title from phpbb_topics where forum_id=2 order by topic_id desc limit 2";
//连接到mysql服务器 $connection =mysql_connect ($dbhost,$dbuser,$dbpasswd); //打开$dbname数据库 mysql_select_db($dbname,$connection);
$result = mysql_query($query,$connection);
while ($row = mysql_fetch_array($result)) echo $row["topic_title"];
显示如下 引用: 测试3测试2
问题是:我现在想让它一行一行的显示 就像这样一样 引用:
测试3 测试2
how to?
[此贴被 TecZm(teczm) 在 11月18日10时41分 编辑过]
|