PDA

View Full Version : Need help with a $DB_SITE command. Seems pretty easy. HELP PLEASE.


BigJohnson
02-22-2003, 07:10 PM
Help I have this command in the newreply.php and what it does is find the number of of new threads made in certain forums and average it out a month since the persons registration date.

$threads = $DB_site->query_first("SELECT COUNT(*) as counter FROM thread WHERE postuserid=$bbuserinfo[userid] AND forumid IN(23, 24, 25, 26, 27, 28, 29, 30, 32, 33, 34, 35, 36, 37, 38, 55, 63, 65, 66, 67) AND dateline>".(time()-2592000));


That line goes in this bunch of code.

$threads = $DB_site->query_first("SELECT COUNT(*) as counter FROM thread WHERE postuserid=$bbuserinfo[userid] AND forumid IN(23, 24, 25, 26, 27, 28, 29, 30, 32, 33, 34, 35, 36, 37, 38, 55, 63, 65, 66, 67) AND dateline>".(time()-2592000));
if(in_array($threadinfo[forumid],array(23, 24, 25, 26, 27, 28, 29, 30, 32, 33, 34, 35, 36, 37, 38, 55, 63, 65, 66, 67)) and $threads[counter]<2) {
eval("standarderror(\"".gettemplate("error_notenoughthreads")."\");");
exit;
}

but instead of searching for the number of threads that way I made a field in the USER table called THREADCOUNTER. the THREADCOUNT field has a number in the field and goes up 1 everytime i new thread is made in certain forums.

What I would like to do is. Use the number in the THREADCOUNTER field instead of this code

$threads = $DB_site->query_first("SELECT COUNT(*) as counter FROM thread WHERE postuserid=$bbuserinfo[userid] AND forumid IN(23, 24, 25, 26, 27, 28, 29, 30, 32, 33, 34, 35, 36, 37, 38, 55, 63, 65, 66, 67) AND dateline>".(time()-2592000));

because with the new code the counter does not decrease when a thread is deleted.

What I don't know how to do is change the code so it works. I hope someone can understand me and help me out by tell me the code I should use. Thank you.

BigJohnson
02-22-2003, 11:44 PM
bump

BigJohnson
02-23-2003, 09:40 AM
Can someone please help me thanks

Xenon
02-23-2003, 09:55 AM
no need of bumping twice a day, some of us also have a live and can just look into the board every second day or so.....

instead of that:
$threads = $DB_site->query_first("SELECT COUNT(*) as counter FROM thread WHERE postuserid=$bbuserinfo[userid] AND forumid IN(23, 24, 25, 26, 27, 28, 29, 30, 32, 33, 34, 35, 36, 37, 38, 55, 63, 65, 66, 67) AND dateline>".(time()-2592000));
if(in_array($threadinfo[forumid],array(23, 24, 25, 26, 27, 28, 29, 30, 32, 33, 34, 35, 36, 37, 38, 55, 63, 65, 66, 67)) and $threads[counter]<2) {
eval("standarderror(\"".gettemplate("error_notenoughthreads")."\");");
exit;
}

this:
if(in_array($threadinfo[forumid],array(23, 24, 25, 26, 27, 28, 29, 30, 32, 33, 34, 35, 36, 37, 38, 55, 63, 65, 66, 67)) and $bbuserinfo[threadcounter]<2) {
eval("standarderror(\"".gettemplate("error_notenoughthreads")."\");");
exit;
}

BigJohnson
02-23-2003, 10:25 AM
Awesome. But I need the average thingy in there too. How would I do that?
It averages it out towards a month.

Xenon
02-23-2003, 11:26 AM
not with your implementation.

if you want the average also, you have to set up an extra field or use the old method..

BigJohnson
02-23-2003, 11:29 AM
Well with the old method the thing is when a thread is deleted the thread count goes down and so does the average.

I want the average to stay the same and not go down if you delete a thread.

What will I have to create a new field for?

Do you think you could help me out? I am a little confused on what the new field would be for in the first place.

BigJohnson
02-25-2003, 10:30 PM
bump please help xenon

BigJohnson
02-26-2003, 09:05 AM
Sorry to bump again but my forums are down till I get this done. I hope someone can help me. Thanks.

Xenon
02-26-2003, 05:11 PM
use the old version till someone posts what you want exactly...

i have no time these days to take a closer look to any requests..

BBallmster
03-01-2003, 05:25 PM
I like what you have done so far and i am sorry to ask but is there anyway you might be able to tell me how to create the field i am not a total vb newb, but i am not sure on how to make another field and where.

If you could help it would be greatly appreciated.
BBallmster

BigJohnson
03-05-2003, 07:31 PM
bump.