Cita:
Quiero que solo muestre los post de las encuestas, que en mi caso sería<?php
//Edita lo siguiente
$folder = "foro"; // Carpeta del foro
$messages = "3"; // Número de mensajes a buscar
//No edites lo siguiente, a menos que sepas como hacerlo
include($folder . "/config.php");
$conn = mysql_connect($dbhost,$dbuser,$dbpasswd);
mysql_select_db($dbname,$conn);
$sql = "SELECT * FROM " . $table_prefix . "posts ORDER BY post_time DESC";
$posts = mysql_query($sql,$conn);
$round = 0;
while( $row = mysql_fetch_array($posts) )
{
if( $round <= $messages )
{
//Forum name
$forum_sql = "SELECT forum_name FROM " . $table_prefix . "forums WHERE
forum_id=" . $row["forum_id"];
$forum = mysql_query($forum_sql,$conn);
$forum_result = mysql_fetch_array($forum);
$forum_name = $forum_result["forum_name"];
//User name
$user_sql = "SELECT username FROM " . $table_prefix . "users WHERE
user_id=" . $row["poster_id"];
$user = mysql_query($user_sql,$conn);
$user_result = mysql_fetch_array($user);
$user_name = $user_result["username"];
//Topic name
$topic_sql = "SELECT topic_title FROM " . $table_prefix . "topics
WHERE topic_id=" . $row["topic_id"];
$topic = mysql_query($topic_sql,$conn);
$topic_result = mysql_fetch_array($topic);
$topic_name = $topic_result["topic_title"];
//Dumping /viewforum.php?f=9
echo '<a href="' . $folder . '/viewtopic.php?t=' . $row["topic_id"] . '">' . $topic_name . "</a><br>\n";
echo 'Publicado en <a href="' . $folder . '/viewforum.php?f=' . $row["forum_id"] . '">' . $forum_name . '</a><br>' . "\n";
if( $round < $messages )
{
echo "__________________<br>\n";
}
$round++;
}
}
mysql_close($conn);
?>
//Edita lo siguiente
$folder = "foro"; // Carpeta del foro
$messages = "3"; // Número de mensajes a buscar
//No edites lo siguiente, a menos que sepas como hacerlo
include($folder . "/config.php");
$conn = mysql_connect($dbhost,$dbuser,$dbpasswd);
mysql_select_db($dbname,$conn);
$sql = "SELECT * FROM " . $table_prefix . "posts ORDER BY post_time DESC";
$posts = mysql_query($sql,$conn);
$round = 0;
while( $row = mysql_fetch_array($posts) )
{
if( $round <= $messages )
{
//Forum name
$forum_sql = "SELECT forum_name FROM " . $table_prefix . "forums WHERE
forum_id=" . $row["forum_id"];
$forum = mysql_query($forum_sql,$conn);
$forum_result = mysql_fetch_array($forum);
$forum_name = $forum_result["forum_name"];
//User name
$user_sql = "SELECT username FROM " . $table_prefix . "users WHERE
user_id=" . $row["poster_id"];
$user = mysql_query($user_sql,$conn);
$user_result = mysql_fetch_array($user);
$user_name = $user_result["username"];
//Topic name
$topic_sql = "SELECT topic_title FROM " . $table_prefix . "topics
WHERE topic_id=" . $row["topic_id"];
$topic = mysql_query($topic_sql,$conn);
$topic_result = mysql_fetch_array($topic);
$topic_name = $topic_result["topic_title"];
//Dumping /viewforum.php?f=9
echo '<a href="' . $folder . '/viewtopic.php?t=' . $row["topic_id"] . '">' . $topic_name . "</a><br>\n";
echo 'Publicado en <a href="' . $folder . '/viewforum.php?f=' . $row["forum_id"] . '">' . $forum_name . '</a><br>' . "\n";
if( $round < $messages )
{
echo "__________________<br>\n";
}
$round++;
}
}
mysql_close($conn);
?>
http://www.muestrate.cl/foro/viewforum.php?f=9