PDA

View Full Version : Custom query in postbit


leenster
02-22-2009, 09:29 PM
Hey guys in my vb database i have a custom table that contains information about our users. We run a couple game servers and in that table we have the stats of our members.

my question is how do i add some of this info into the postbit?

The info can be linked through a custom profile field.

so
let say the custom table is called stats

Select * from stats where playername='$post[fieldXX]';

where would i put the query?
how do i display this only if the member has the custom profile field filled in?

thanks in advance ..

TigerC10
02-22-2009, 10:19 PM
Have you done a search of the forums?

https://vborg.vbsupport.ru/showthread.php?t=166290

leenster
02-22-2009, 10:59 PM
I know how to display a custom field, that one is easy.... showing info from a custom table i am not sure about.... thanx though

Lynne
02-22-2009, 11:11 PM
I'm not sure I completely understand. Are you looking for the stats info for the user who's post you are seeing? If so, I'm not sure you mean playername='$post[fieldXX]', but instead playername='$post[username]', right? If so, then I think you can hook into the $posts query to grab that info. You'd have to ask for the columns you want (I wouldn't suggest doing stats.*, but instead exactly which fields you want) and also do a JOIN.

leenster
02-22-2009, 11:23 PM
i do mean playername='$post[fieldXX]' < that contains the name of the player in the game, but yes i do want to show the stats of the person that posted...

the custom table does not contain the users name on the forum, just his playername

how do i hook into the post query?

Lynne
02-23-2009, 03:33 AM
If you want to hook into the $posts query, then I think you would use the hook location 'showthread_query'. I'm not great at joins (the different types still confuse me), so I can't help with that part.

Dismounted
02-24-2009, 04:47 AM
I'm not great at joins (the different types still confuse me), so I can't help with that part.
Most of the time, a left [outer] join will fit the bill.