Need help with a news/blog listing page

I am working on a blog that shows threads on a php page and hooks into a specific forum on my site.
The code was just something given to me on the MyBB forum for hooking into a thread using MySQL.
I don't know much of PHP or MySQL so I need someone willing to help finish this.

Here is what I have already on a blog page.
It consists of 2 files the bootstrap framework header/footer also used on the front page then a .inc file for the php code in the middlehttps://cajgo-support.com/blog.php

Here is the .inc file code.
There's some useless code in here for progress the original author used for himself which needs removing, I removed some but not all as I don't know what I can take out.

There is another set of code that hooks into MyBB.
Would doing it this way be more suitable?
This way is more complete and just needs some tweaking.
Demo of the code below with some slight modification since posting the code here.https://cajgo-support.com/blog-1.php
Tell me your thoughts.

Working on the second code but cant figure out a read more tag.
Any advice and help?

Update:
I have worked around the issue.
I did a readmore tag in MyCode which used the bootstrap collapse div tag so that only activates on bootstrap pages being the front page.
Then in the blog include I put a read more button to link back to the thead.
I'll try and add a .... tag in also for long posts that shows on the front page only.

I have a "*** Click 'Read More' to read the rest of this article ***" line now showing if there's more to the article.

Now I'm looking for all the advice I can get and any improvements on styling etc.
I already have s list of stuff here but looking for anything to make this pretty and fully functional as a premiere blogs and article list.https://community.cajgo-support.com/thread-45.html

For the more advanced features like multi page I need someone who can modify the code with that as that is above my skills.

Working on the second code but cant figure out a read more tag.
Any advice and help?

Update:
I have worked around the issue.
I did a readmore tag in MyCode which used the bootstrap collapse div tag so that only activates on bootstrap pages being the front page.
Then in the blog include I put a read more button to link back to the thead.
I'll try and add a .... tag in also for long posts that shows on the front page only.

I have a "*** Click 'Read More' to read the rest of this article ***" line now showing if there's more to the article.

Know about limit.
The thing is I don't know how to show all blogs / threads then have a multipage with a limit like our news posts or threads etc per page here.
Limit is great for showing for the most recent blogs on the sidebar though.

Gumby' has introduced you to pagination. Usually you have to read some URL parameters to get the current page (eg mysite.com/blog/page/2, you need to get the 2), then use that parameter to get the relevant results.

The second method of database access looks the better option. The first is directly connecting to the database, and I believe the way it is sending parameters is the way to get hacked via SQL-injection, so that's not good. The second method you posted looks to be using the forum software's helpers/shortcuts for accessing the database. This should be safer, and also more convenient. If you look into it, it might already provide easy methods for pagination.

Gumby' has introduced you to pagination. Usually you have to read some URL parameters to get the current page (eg mysite.com/blog/page/2, you need to get the 2), then use that parameter to get the relevant results.

The second method of database access looks the better option. The first is directly connecting to the database, and I believe the way it is sending parameters is the way to get hacked via SQL-injection, so that's not good. The second method you posted looks to be using the forum software's helpers/shortcuts for accessing the database. This should be safer, and also more convenient. If you look into it, it might already provide easy methods for pagination.

Click to expand...

Cheers for the message, it's using the second code, I'm not too sure about doing pagination or getting the prefix field by linking the variable in the post row to the display span tag as I'm not a coder I just manipulate what I have.

Pagination is one, showing the prefix with its span tag then creating a prefix filter as a kinda category is what I want to expand to.

A lot of this for these extras are over my head, will research online but can use a hand so until that they will have to wait.