spaceranger Posted March 2, 2012 Share Posted March 2, 2012 i have some code that im editing for an auction website, the thing is that i need the $all_unpaid = false if the bid_amount is zero, I tried several tweaks but no results, perhaps some1 can have some suggestions? function direct_payment_multiple ($invoice_id, $items_array, $dp_array, $buyer_id) { $output = false; $nb_sub_arrays = count($dp_array); if ($nb_sub_arrays) { $array_result = $dp_array[0]; for ($i=1; $i<$nb_sub_arrays; $i++) { $array_result = @array_intersect($array_result, $dp_array[$i]); } $all_unpaid = true; for ($i=0; $i<$nb_sub_arrays; $i++) { $all_unpaid = (!$items_array[$i]['direct_payment_paid'] && !$items_array[$i]['flag_paid'] && $items_array[$i]['bid_amount'] > 0) ? $all_unpaid : false; } $same_currency = true; $currency = $items_array[0]['currency']; for ($i=0; $i<$nb_sub_arrays; $i++) { $same_currency = ($currency == $items_array[$i]['currency']) ? $same_currency : false; } } $output = (is_array($array_result) && $all_unpaid) ? true : false; return $output; } some overview some overview, this auction website allows users to place a bid of 0.00, if no-one outbids them then they get the item for free, however if someone does outbid them then regular code applies so if payment has been made and is greater then zero then all_unpaid is true, if payment equal to zero or there is no payment then all_unpaid is false spam removed Quote Link to comment https://forums.phpfreaks.com/topic/258124-php-if-else-statement-with-exception/ Share on other sites More sharing options...
S3cr3t Posted March 4, 2012 Share Posted March 4, 2012 $all_unpaid = (!$items_array[$i]['direct_payment_paid'] && !$items_array[$i]['flag_paid'] && [b]$items_array[$i]['bid_amount'] >= 1[/b]) ? $all_unpaid : false; Quote Link to comment https://forums.phpfreaks.com/topic/258124-php-if-else-statement-with-exception/#findComment-1323772 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.