Jump to content

IPB script help


mikas

Recommended Posts

Hey guys. I am not very experienced with php, but what I am trying to do is display posts from a certain forum on my home page. I was supplied with the script used by the site owner, but once I implemented it, nothing showed up. I created a file to connect to my db, which works. All that was left was to, as the supplier said, "echo out the variables". I did what I thought that meant and nothing happened. here is the supplied code.

[code]<?php
include("includes/db.php"); //this is a file that connects to the mysql database.
$pages = mysql_num_rows(mysql_query("SELECT tid FROM ipb_topics WHERE forum_id=6")); //Counts how many topics are in the news forum.
if(!$show) $show="0";
$limit="4"; //This is the value you give to cap the amount of posts it will show on your main page.

$read_dates="SELECT * FROM ipb_topics WHERE forum_id=6 ORDER BY tid DESC LIMIT $show,$limit";
$read_dates_result=mysql_query($read_dates);
while($datea=mysql_fetch_array($read_dates_result))
{
$read_post="SELECT * FROM ipb_posts WHERE topic_id='$datea[tid]' ORDER BY pid LIMIT 1";
$read_post_result=mysql_query($read_post);
while($data=mysql_fetch_array($read_post_result))
{
?>
++put your repeatable news table here. with variables echo'd out with the variables $datea[columnfield] or $data[columnfield] (ex. $data['post'] [[which is the news post text]] or $datea['title'] [[which is the thread's title]]). If you check out the ipb_topics and ipb_posts db tables, you can sort of see what to do. ++
<?php
}
}
?>[/code]

I made sure I had a forum with the id of 6 and all, just so I didnt have to alter the code any. What I was doing on my main page after pasting that code was where it said to put it:
[code]<?php echo $data['post'] ?>[/code]
and TONS of variations of that. Any help guys? Thanks!
Link to comment
https://forums.phpfreaks.com/topic/32867-ipb-script-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.