CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Going Insane!

Print topic Send  topic

Author Message
jon
Posted: 03/31/2002, 9:59 PM

Ok, this probably seems simple enough but after 2 days of scratching my head (I'm a novice perl programmer, native pascal), I figure i'll turn to those who are a bit more skilled!

Ok, I have 2 tables: Users and Items. Each time someone adds a post to the Items table, I want a variable in their user record named 'credits' to decrease. (I.e. You get 3 posting credits, and then must buy more type of program eventually).

My problem is that I am at a loss at how to reference/change things in codecharge. I tried playing around with a sql statment that looked like this "update users set credits=<some code to get current credit amount>-1 where id=GetSessionVar("UserID")" but can't seem to figure out how to execute that in codecharge.

Any help / sample code is appreciated. Thanks!

Jon Westfall.
Charles
Posted: 03/31/2002, 11:34 PM

mail me your....code charge site and dbase...
We don't spit details unless we sit on it...

webmaster@charmangel.zzn.com

Oh yah I "LOVE" codecharge that's why whenever
I regenerate I get "modified outside CC Replace?"

Cheers, welcome to CodeCharge

webmaster@charmangel.zzn.com
Nicole
Posted: 04/01/2002, 2:05 AM

Jon,
put the code like below to Before Insert and/or Before Update event (depending on record inserting or updating in Items table)

exec_sql("update users set credit=credit-1 where id=".ToSQL(session.getAttribute("UserID"), "Number"))

you'll find all used functions in common file.
jon
Posted: 04/01/2002, 5:12 AM

Thank you - the code worked!

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.