Jump to content

Last Topics Posted??? Help I'm new!


Slovig

Recommended Posts

Hey. I'm new here but do have a site. I used to have MKPortal installed but that got messed up and I un-installed it. Now I'm trying to build my own homepage, but was wondering if there is a link to a code to show the last 10 threads that were posted on my forums? Can anyone help?

[move]Thank you[/move]

Jesse
Slovig.com
Link to comment
https://forums.phpfreaks.com/topic/30688-last-topics-posted-help-im-new/
Share on other sites

Have you got the details of the table where your forum posts are stored? (presuming you have the forum posts stored in a mrsql table on your site!)

Just has a link that goes to a page querying the table of posts, sort the posts most recenet date first and restrict results to 10 records.
Is it MySQL database? I havn't worked with any other database but I am sure it is all pretty much the same!

You will need to make sure you have a username and password to access the database and then also the table name and table column names for the table your forum posts are stored in.

Do you have a page that currently displays your forum posts? Perhaps you can get the php script that displays that page and we can get the details we need from that.
  • 3 weeks later...
Ok. With some help from one of my friends. I think I got it all down. But when I upload the page to my site, and go to it, all it displays is "251", which isn't even the right number of posts on my forums....

So far, this is my code

[code]

<?php
$link = mysql_connect('localhost', '*******', '*******');
if (!$link) {
  die('Could not connect: ' . mysql_error());
}

mysql_select_db ("*******");

$result = mysql_query($sql = 'SELECT * FROM `ibf_posts` ORDER BY `post_date` DESC LIMIT 0, 30 ');
if (!$result) {
  die('Could not query:' . mysql_error());
}
echo mysql_result($result, 2);

mysql_close($link);
?>

[/code]

If someone could help. Like I said, my friend helped write this, I only know what some of it does. Oh yea. where the stars are, i have what is needed there, just not posting that.

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.