The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
MySQL, PHP and new posts?
Apologies if this has been explained previously, but I couldn't find an answer, though I did find some code to get me started. I need to pull new posts from the database and display the data on an external PHP page. This is the query I have to start out with:
Quote:
Thanks in advance. |
#2
|
||||
|
||||
[sql]SELECT p.postid, p.username, p.userid, p.dateline, p.pagetext, t.forumid
FROM " . TABLE_PREFIX . "post AS p LEFT JOIN " . TABLE_PREFIX . "thread AS t USING threadid WHERE visible = 1 ORDER BY dateline DESC LIMIT 10[/sql] |
#3
|
|||
|
|||
Please be aware that the above query does not take permissions into consideration. You might get posts from forums that are not accessible to general public.
Maybe it is easier to use RSS for this. |
#4
|
||||
|
||||
Adding this would take care of that, wouldn't it?
Code:
AND (forum.options & 4096) |
#5
|
|||
|
|||
Not sure which forum option is 4096, but that would not take any usergroup/forum permissions into account.
|
#6
|
||||
|
||||
I looked in the bitfield file and this is what it says:
Code:
<bitfield name="countposts">4096</bitfield> |
#7
|
|||
|
|||
Thanks for the code. I think I'm using a version of MySQL that doesn't support some of it. This is what I could get to work:
Code:
SELECT p.postid, p.username, p.userid, p.dateline, p.pagetext FROM post AS p WHERE visible = 1 ORDER BY dateline DESC LIMIT 10 |
#8
|
||||
|
||||
The ID is the link to the thread/post. The dateline is the date/time.
|
#9
|
|||
|
|||
I thought postid just gave a number, not a HTML link? I assume if I can get the threadid I can use that to do another query to get the thread title?
|
#10
|
||||
|
||||
The number in the link to threads is the ID .
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|