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? 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 > 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 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] Link to comment https://forums.phpfreaks.com/topic/35916-solved-try-catch/#findComment-170327 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.