View Full Version : Probobly simle question.
DonLKSAB
01-03-2003, 11:48 AM
Hi dudes.
I have a simple question ( I hope )
I have added a new "User Profile Field" called Nick.
Now i want to use it to find a rank in my Db.
The DB looks like this:
Table Name: stats_individual
Rows: name , rank
What i need is to display the "rank" under "posts" in the postbit using the "nick" the user provided in the CP.
I have tried to edit the postbit but i cant get it to work :-(
My test:
Location: $post[field2]
Posts: $post[posts]
Rank: SELECT rank FROM stats_individual WHERE name=$post[field5]
That dident work ( Not that i actualy belived that it would )
Any ideas?
/DonLKSAB
DrkFusion
01-03-2003, 04:46 PM
Woa what you said is confusing :-p
SELECT rank FROM stats_individual WHERE name=$post[field5]
Will not work in the post biut :p
You may want to try putting in the showthread.php
$ranking = $DB_site->query_first("SELECT rank FROM stats_individual WHERE name='$post[field5]'");
That should select the field rank where the name is whatever
I am still bit confused on what you want, but try that.
Also then in the postbit
put
Rank: $ranking[rank]
Xenon
01-03-2003, 08:10 PM
@Arunan: Thank would create an extra query for each post!!
It would work you are right, but one more query per post is not good ;)
@Don:
open showthread.php find:
FROM post
".iif($forum[allowicons],'LEFT JOIN icon ON icon.iconid=post.iconid','')."
LEFT JOIN user ON user.userid=post.userid
LEFT JOIN userfield ON userfield.userid=user.userid
DIRECTLY after that lines put this line:
LEFT JOIN stats_individual ON (stats_individual.name=userfield.field5)
then few lines above there is this part:
post.*,post.username AS postusername,
change ti to:
post.*,stats_individual.rank,post.username AS postusername,
then you can use $post[rank] in your postbit template
DonLKSAB
01-03-2003, 09:41 PM
Well both look good.
But non of them work :-(
I dont get any errors or any indication that something is wrong.
It simply dont display anything.
/DonLKSAB
DrkFusion
01-03-2003, 09:44 PM
Originally posted by Xenon
@Arunan: Thank would create an extra query for each post!!
It would work you are right, but one more query per post is not good ;)
@Don:
open showthread.php find:
FROM post
".iif($forum[allowicons],'LEFT JOIN icon ON icon.iconid=post.iconid','')."
LEFT JOIN user ON user.userid=post.userid
LEFT JOIN userfield ON userfield.userid=user.userid
DIRECTLY after that lines put this line:
LEFT JOIN stats_individual ON (stats_individual.name=userfield.field5)
then few lines above there is this part:
post.*,post.username AS postusername,
change ti to:
post.*,stats_individual.rank,post.username AS postusername,
then you can use $post[rank] in your postbit template
:p ur rite...lost my mind, because I didn't tell him where to put it either lol.
That above should work.
DonLKSAB
01-03-2003, 09:53 PM
Ahh.
There were 2 places in Showtread to change.
One in the begining and one in the end :-)
Now it works.
Thanks dudes.
/DonLKSAB
Xenon
01-04-2003, 09:58 AM
:)
you're welcome :)
@Arunan: :), as long as i saw where you wanted to put it, and could give a better advice it's ok :)
I remember my own first small hacks to showthread.php, without the microstats hack i always thought all is good ^^
DrkFusion
01-04-2003, 02:41 PM
Hehe, thanks Xenon :) You have been teaching me new things alot, and they are coming in handy alot too. For that I thank you!
Whenever you need anything...anything at all, my pm box/email inbox are open :)
Xenon
01-04-2003, 03:15 PM
:)
you're always welcome :)
hmm, yeah i need time, but i'm sure you can't send it to me right? ;)
well, maybe i'll find something in future.
it's enough to see you've learned a lot so you could help others :)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.