![]() |
pulling data from other table for postbit
Hiya,
I am working on a hack and I am nowstuck on how to pull data from one field from a different table within my main vb db and then attach that to each user. the other table is created for users who subscribe so I want to add an extra bit to their postbit which displays "subscribed" or something similar. The other table is called adult and has fields called, uid (which contians the users forumid), fname (forum username), email (forum email address) and datesigned (has the date they subscribed). I have played around with the showthread but no success as yet. any help on where to look appreciated :) |
use a join :)
not sure what your query looks like, but it sounds like you need a LEFT JOIN. Should be pretty simple, here's a small article on joins -http://www.devshed.com/Server_Side/MySQL/SQLJoins/ :) |
i had a look at the join statement earlier but could get it to work. this is what i ended up with:
Code:
$adult=$DB_site->query("SELECT users.userid FROM users how close am I? the postbitextra is the bit i want to pull into the postbit and display for each user in the thread view which I presume will end up being something like $adult[extrabit] in the postbit template in-order to display it. |
in showthread.php at around line 400ish
PHP Code:
You can refer to your fields as normal in your template :) |
edit: oops! my bad!
just realised that adult.uid should actually be adult.fid! it now runs but not sure if it is working. I am calling $adult[extra] in the postbit but its not pulling the info in. Am i right in calling $adult[extra]? |
You should be able to do it with $post[extra] :)
|
duh! now you see what your working with...a complete numpty! That all works a sweet as a nut now :)
My next little challenge is to get it to display this extra field in the user info. I have looked in member.php and in the start get info section added the following: Code:
$extrabit=$DB_site->query("SELECT extra FROM adult WHERE fid = '$userid'"); Any clues on this? |
All times are GMT. The time now is 10:04 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|