Search This Blog

Tuesday, June 2, 2009

On9Ads.com - 2nd June

I finally got it figured out! Again, another issue came to my mind and I was stumped for 2 days before picking out answers from here and there and finally got the answers I wanted. I kept on looking and looking but the answers are always weird and too complicated to be implemented. Some have tonnes of codes that make me even more frustrated. Its about working with Maths using PHP and MYSQL.

Example:-
User key in two numbers and the system calculates the product (multiplication) of both numbers. All three numbers must be stored into the database for later retrieval. So, how to do with Dreamweaver?

Solution:-
Again, a little bit of programming is required and full understanding of what you're trying to do is required. So, after creating a dynamic form with ADDT which inputs in both values. Then you have to make a Custom Trigger where the code will be like:-
<<

function Trigger_Custom(&$tNG) {
$a = $tNG->getColumnValue('multiply_1');
$b = $tNG->getColumnValue('multiply_2');
$c = $tNG->getColumnValue('multiply_id');
$total = $a*$b;
$sql = "UPDATE multiply_test SET multi_result = '$total' WHERE multiply_id = '$c'";
$result = mysql_query($sql);
}

>>
Where
multiply_test = your table name
multi_result = column that you want to place the results
And there you have it your simple product calculator!

2 comments:

HP said...

halo, 1st time visit (:
hmm? online advertisement ?

Ultima said...

Hi Ping,

Yup, trying to do business, but haven't got the site up and running yet. Feel free to visit:-

http://www.on9ads.com

Maybe around July or August should start already.