acp26b Posted January 27, 2007 Share Posted January 27, 2007 Does PHP version 4.4.4 have try catch blocks? Or are they not untill PHP 5? Quote Link to comment https://forums.phpfreaks.com/topic/35916-solved-try-catch/ Share on other sites More sharing options...
trq Posted January 27, 2007 Share Posted January 27, 2007 No. PHP5 > Quote Link to comment https://forums.phpfreaks.com/topic/35916-solved-try-catch/#findComment-170312 Share on other sites More sharing options...
acp26b Posted January 27, 2007 Author Share Posted January 27, 2007 Dang, any suggestions for this?[code]try { $db_percent = mysql_result($balancefeeresult,0,"percentcharge"); $db_amount = mysql_result($balancefeeresult,0,"amount");}catch (Exception $e) { $exception = "true";}if($exception != "true"){ $db_percent = ($db_percent * .01); $charge = ($db_percent * $db_amount);}else{ $charge = NULL;}[/code]What i want to do, is if no amount comes out of db then set charge to null Quote Link to comment https://forums.phpfreaks.com/topic/35916-solved-try-catch/#findComment-170314 Share on other sites More sharing options...
acp26b Posted January 27, 2007 Author Share Posted January 27, 2007 got it![code]$balancefeenumber = mysql_numrows($balancefeeresult);if(!$balancefeenumber){ $charge = 0; }else{ $db_percent = mysql_result($balancefeeresult,0,"percentcharge"); $db_amount = mysql_result($balancefeeresult,0,"amount"); $db_percent = ($db_percent * .01); $charge = ($db_percent * $db_amount);}[/code] Quote Link to comment https://forums.phpfreaks.com/topic/35916-solved-try-catch/#findComment-170327 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.