Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

Help

Codes here !

Moderators: macek, egami, gesf

Help

Postby nsmith » Tue Sep 04, 2012 8:49 am

Hi all,

I am new to this board and new to php. I have one line I need to change in the code I am modifying. The line is:

return ($method->item + $method->handling)*$this->getTotalAmount($total_cost);

What I need to do is add 4 percent to just the items which are an array of integers but this does not seems to work:

return ($method->item * .04 + $method->handling)*$this->getTotalAmount($total_cost);

It would be great if someone could tell me what I am doing wrong. Thanks.
nsmith
New php-forum User
New php-forum User
 
Posts: 1
Joined: Tue Sep 04, 2012 8:43 am

Re: Help

Postby johnj » Tue Sep 04, 2012 7:21 pm

if item is an array (as you have said) then you need to get the specific element within the array before multiplying by 0.04.
johnj
php-forum Super User
php-forum Super User
 
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm


Return to mySQL & php coding

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron