Created
July 3, 2012 19:21
-
-
Save Equinox-/3042146 to your computer and use it in GitHub Desktop.
Fetches all the topics in the given forum.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$mysql_host = ""; | |
$mysql_database = "devoxstu_smf391"; | |
$mysql_user = ""; | |
$mysql_password = ""; | |
$forum = 1; | |
mysql_connect($mysql_host, $mysql_user, $mysql_password)or die("cannot connect"); | |
mysql_select_db($mysql_database)or die("cannot select DB"); | |
//Grab the topics | |
$sql = "SELECT * FROM `smf_topics` WHERE `id_board` ='$forum' ORDER BY `id_topic` DSC;"; | |
$result = mysql_query($sql); | |
if ($result !== FALSE) { | |
$topics = array(); | |
while ($arr = mysql_fetch_array($result)) { | |
array_push($topics,$arr); | |
} | |
mysql_free_result($result); | |
foreach ($topics as $topic) { | |
$sql = "SELECT * FROM `smf_posts` WHERE `id_msg` ='".$topic['id_first_msg']."';"; | |
$sResult = mysql_query($sql); | |
if ($sResult !== FALSE) { | |
$post = mysql_fetch_array($sResult); | |
if ($post !== FALSE){ | |
echo "<b>".$post['subject']."</b><br />"; | |
echo parse_bbc($post['body']); | |
echo "<hr>"; | |
} | |
mysql_free_result($sResult); | |
} | |
} | |
} | |
mysql_close(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment