Поставяне на код в таблица.

ReD_z0n3

Registered
Как да поставя този код в определена таблица.

Ето го кода.

PHP:
<?php

$connection = mysql_connect("localhost", "username", "password");
$db = mysql_select_db("db", $connection);

$query = mysql_query("select * from phpbb_topics where forum_id like '10' order by topic_last_post_id desc limit 0,10");
while($rows = mysql_fetch_array($query))
{
$forum = $rwz[forum_name];
$catid = $rwz[cat_id];
$qry2 = mysql_query("select * from phpbb_categories where cat_id='$catid'");
$cat = $rwz2[cat_title].'<br />';
if (strlen($rows[topic_title])>1){
printf("<a href=\"forum/viewtopic.php?t=%d\">%s %s</a> [%d]", $rows[topic_id], $cat, ((strlen($rows[topic_title])>42)?substr($rows[topic_title],0,42)."...": $rows[topic_title]), $rows[topic_replies]);
}
}

?>

Ето в момента , как изглежда

2990716e.jpg


Искам да бъде ето така.

2990720l.jpg
 
PHP:
<?php

$connection = mysql_connect("localhost", "username", "password");
$db = mysql_select_db("db", $connection);

$query = mysql_query("select * from phpbb_topics where forum_id like '10' order by topic_last_post_id desc limit 0,10");
echo '<table width="100%" cellspacing="0">
<tbody>
<tr>
<th scope="col" width="50">aaaa</th>
<th scope="col" width="100">bbbb</th>
</tr>';
while($rows = mysql_fetch_array($query))
{
$forum = $rwz[forum_name];
$catid = $rwz[cat_id];
$qry2 = mysql_query("select * from phpbb_categories where cat_id='$catid'");
$cat = $rwz2[cat_title].'<br />';
if (strlen($rows[topic_title])>1){
printf("

<td align='right'><center><a href=\"forum/viewtopic.php?t=%d\">%s %s</a></center></td>
<td align='right'><center> [%d]", $rows[topic_id], $cat, ((strlen($rows[topic_title])>42)?substr($rows[topic_title],0,42)."...": $rows[topic_title]), $rows[topic_replies]);?></center></td></table>
<?php
}
}
?>

Пробвай би трябвало да стане.
 

Back
Горе