mikas Posted January 4, 2007 Share Posted January 4, 2007 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]<?phpinclude("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! Quote Link to comment https://forums.phpfreaks.com/topic/32867-ipb-script-help/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.