![]() |
Counting how many X is in a field for each id in a table
Hi guys,
I would like to know how I would go about running a sql php code that will tell me how many times the forumidX shows up in a field in the WHOLE table. For instance forumid 8 from the field5 in the profilefields table. Thanks in advance, appreciate all and any help. -Arunan |
hmm, not sure if i understand you right, but i think you want to have this:
PHP Code:
|
Ah Thanks Xenon, I will try it out.
Thanks again, you always are a great help -Arunan |
Well, I am doing a top 5 kinda thing, how would I do something like that?
I want to find out how many people have 1 forumid in field5 and make that the top forumid kinda thing. :-/ Thanks |
ohhh, thats a bit ahead of my sql-knowledge.
don't know if this is even possible i just know a (real) bad but working way, but it is very very hardcoded: PHP Code:
i know, it's veryy bad, but i don't know another way .... |
Thanks Stefan,
Well I guess I will take an easier way out, I will make the value of the field increase by 1 every time the forumid is added to there profile field, now how do I stop users from doing it more than once? Sorry, if I am asking too many questions :( I am yet a weee litttle Php Padwan, still learning the ways :) -Arunan |
well you have to check if they already have had a id inserted, and reduce the value at this id by one and then increase the value for the new id...
with $bbuserinfo[fieldx] you can acces the old value and compare it with the new one befor the new value is entered to the db |
I put the fieldX+1, but it seems to be adding 13 :-/
-Arunan |
All times are GMT. The time now is 04:35 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:
|