2

Smarty の「noob」です。.tpl ファイルの 1 つで次のコードを実行する必要があります。

  <? // SELECT sql query
$sql = "SELECT 'id' , 'title' FROM `forum_posts` WHERE bid = '1' ORDER BY 'date' DESC LIMIT 4"; 

// perform the query and store the result
$result = query($sql);

// if the $result contains at least one row
if ($result->num_rows > 0) {
  // output data of each row from $result
  while($row = $result->fetch_assoc()) {
    echo '<tr>
        <td><a href="http://www.site.com/forum.php?topic='. $row['id']. '">'. $row['title']. '</a>  </td>  
        </tr>   ';
  }
}
else {
  echo 'No news';
}
?>

私は今3時間試していますが、ウェブ中をサーフィンしていますが、成功していません. 助けてください!

4

2 に答える 2