โค้ดที่เขียน
$Sql = "SELECT t.ID_TOPIC FROM $prefix AS t where ID_BOARD IN($board) order by ID_TOPIC DESC limit $topic,$list ";
$result = mysql_db_query($db_name,$Sql);
$nrow = mysql_num_rows($result);
while ($num = mysql_fetch_array($result))
{
$tid = $num["ID_TOPIC"];
$msql = "select m.ID_TOPIC,m.subject,m.icon,m.posterTime,a.ID_ATTACH,IFNULL(a.ID_ATTACH,0) AS ID_THUMB from $prefix2 AS m LEFT JOIN $prefix3 AS a ON (m.ID_MSG=a.ID_MSG AND a.ID_THUMB = 0) where m.ID_TOPIC='$tid' ";
$mresult = mysql_db_query($db_name,$msql);
$marr = mysql_fetch_array($mresult);
$title = $mar["subject"];
$id_attach =$mar["ID_ATTACH"];