vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   Probobly simle question. (https://vborg.vbsupport.ru/showthread.php?t=47321)

DonLKSAB 01-03-2003 11:48 AM

Probobly simle question.
 
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
PHP Code:

$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:
PHP Code:

    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:
PHP Code:

   LEFT JOIN stats_individual ON (stats_individual.name=userfield.field5

then few lines above there is this part:
PHP Code:

post.*,post.username AS postusername

change ti to:
PHP Code:

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

Quote:

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:
PHP Code:

    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:
PHP Code:

   LEFT JOIN stats_individual ON (stats_individual.name=userfield.field5

then few lines above there is this part:
PHP Code:

post.*,post.username AS postusername

change ti to:
PHP Code:

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 :)


All times are GMT. The time now is 11:16 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
  • Page Generation 0.01151 seconds
  • Memory Usage 1,752KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (9)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete