View Full Version : Simple query request
Jhorra
05-24-2004, 02:09 PM
Greetings,
I have been looking around for a good portal or CMS, but have yet to find one that I like. Thus I am just going to put together a simple one myself for my site. The problem is I'm not familiar enough with php to put together the correct query. I need three querys:
Query for last five news posts, specific forum for news.
Query for latest poll and how to output the graph.
Query for welcome box information.
I can manipulate the results for all but the poll. I don't know how to make the graph. Can anyone help me out with this?
Dark_Wizard
05-24-2004, 04:34 PM
Greetings,
I have been looking around for a good portal or CMS, but have yet to find one that I like. Thus I am just going to put together a simple one myself for my site. The problem is I'm not familiar enough with php to put together the correct query. I need three querys:
Query for last five news posts, specific forum for news.
Query for latest poll and how to output the graph.
Query for welcome box information.
I can manipulate the results for all but the poll. I don't know how to make the graph. Can anyone help me out with this?
Take a look at how it's done in poll.php and it's associated templates...
Jhorra
05-24-2004, 04:40 PM
Ok, I can do that for the poll. Is there something I can look at for a welcome box? Basically I want it to pull their Avatar, username and probably if they have a new private messages.
The last 5 news posts I think I know how to do that, but I'm not positive on all the variables. If I had to guess I would say it looks something like this:
$query = "SELECT * from posttable WHERE forum = newsforum and "something to indicate its a new post and not a reply" limit 5"
Does that look right?
Dark_Wizard
05-24-2004, 04:45 PM
Ok, I can do that for the poll. Is there something I can look at for a welcome box? Basically I want it to pull their Avatar, username and probably if they have a new private messages.
The last 5 news posts I think I know how to do that, but I'm not positive on all the variables. If I had to guess I would say it looks something like this:
$query = "SELECT * from posttable WHERE forum = newsforum and "something to indicate its a new post and not a reply" limit 5"
Does that look right?
Close...the table would be "thread" and it would be forumid = $newsforumid
this depends on how you set it up...have you looked at vBIndex or vBAdvanced for a portal system? They are both excellent products.
Jhorra
05-24-2004, 04:49 PM
Well I don't like the floating box look. I want it to fit into this page www.thechristianparent.com The top box on the left will be the welcome box, the second one will be for polls. Then the middle area will be the 5 news posts, except I'll format it so it's more like slashdot news than a post window that you get with vbadvanced.
As far as the query, do I need to put something in to differentiate whether it's a reply or a new thread?
Dark_Wizard
05-24-2004, 04:57 PM
Well I don't like the floating box look. I want it to fit into this page www.thechristianparent.com The top box on the left will be the welcome box, the second one will be for polls. Then the middle area will be the 5 news posts, except I'll format it so it's more like slashdot news than a post window that you get with vbadvanced.
As far as the query, do I need to put something in to differentiate whether it's a reply or a new thread?
It's a little more than that...it would involve the post table and the thread table for the info....
Jhorra
05-24-2004, 05:01 PM
Can you give me the fields I need to query from both tables? I should be able to figure it out from there.
Reeve of shinra
05-24-2004, 05:18 PM
You can just toss the html for that front page into the template for vbindex and work with it a little to get the results your looking for. Personally, I think thats one of the stronger points of VBIndex and VBadvanced. Building your own portal page is a good excersize though so best of luck.
Jhorra
05-28-2004, 03:54 PM
What do I look for to do the welcome box, does vB use sessions where I can just pull the session value, or do I need to check the cookie?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.