Reply to Re: Help with error in script

Your name:

Reply:


Posted by samudasu on 09/28/39 11:40

Ok, i see your problem now. This line "$total_downpayment = '$' .
num_format($total_downpayment); " is causing the problem. What it's
doing is setting total downpayment into a string that looks like
$20,000. Well you can't subtract a number (string) formatted as
$20,000 from a number that looks like 200000. PHP will normally let you
subtract one string from another but the comma and dollar sign are
throwing it off. This will work:


if ($_SESSION['nickname'] == '') {
$_SESSION['nickname'] = 'My Future Home';
}
if ($total_downpayment < 0) {
$total_downpayment = 'You have less than what is needed to pay initial
costs.';
}

print 'Your down payment will be: <strong>$' .
num_format($total_downpayment) . '</strong>
(' . num_format($percentage_down*100) . '%)<br />
Your loan amount will be: <strong>$' .
num_format($_SESSION['house_cost'] - $total_downpayment) .
'</strong><br /><br />';

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация