php ดึงข้อมูลจาก db ของphpbb

ลองดูน่ะครับ

<html>
<body>
<?php
$dbhost = ‘localhost’;
$dbuser = ‘********;
$dbpass = ‘********’;

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die (‘Error connecting to mysql’);
mysql_query(“SET NAMES UTF8”); // เพื่อให้ดึงข้อมูลให้แสดงภาษาไทยครับ

$dbname = ‘xxxxxxxi’;
mysql_select_db($dbname);
$query = "SELECT topic_id, topic_title FROM phpbb3_topics ORDER BY topic_time";
$result = mysql_query($query);

while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "<a href=http://www.mooaoun/phpBB3/viewtopic.php?t=$topic_id\" >{$row[‘topic_title’]} </a><br>" ;
}
mysql_close($conn);

?>
</body>
</html>

Comments are closed.