Gossamer Forum
Quote Reply
Custom Global
I have a field called AdCredits in my user table, which I use to store $$ for advertising on my site. It is also used to reward my editors.

I would like my editors to be able to see how many adcredits the have remaining on their Browser screen when they login (browser_info.html).

This being my very first global I have had a go at writing could someone help me out:

Global User_AdCredits
# Global to return the Editor's username, and number of adcredits remaining
# Example: Welcome John. You have a balance of 25 AdCredits.

sub {
my $adcredits = $DB->table('Users')->select( { 'AdCredits' => $USER->{Username} } );
return $adcredits;
}



I may be way off here, so sorry about that!Blush
Quote Reply
Re: [sooke] Custom Global In reply to
Is it giving any errors? Don't forget, you also need to shift the username variable along (i.e their username, otherwise it won't know who to look for Wink).

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!

Last edited by:

Andy.: Apr 29, 2002, 12:21 AM
Quote Reply
Re: [sooke] Custom Global In reply to
Try:

Code:
sub {
return $DB->table('Users')->select( { Username => $USER->{Username} }, 'AdCredits' )->fetchrow;
}
Quote Reply
Re: [Paul] Custom Global In reply to
Good morning guys, and thanks both!

I'll try that now PaulSmileSmile. I guess I had 50% of it right.... and think I can see the syntax for the select and matching now. Great!

Last edited by:

sooke: Apr 29, 2002, 6:50 AM
Quote Reply
Re: [Paul] Custom Global In reply to
Thanks Paul, thats working great!