multiple variables with if ==
Posted: Thu Mar 20, 2014 5:10 am
I have a column in a table that only shows an echo if a value is == to another value. the echoed value shows a number (which is amount of weeks. . I need to be able to add all these "weeks" together to get a total.
does that make sense?
below are a couple of lines to show what i mean
as you see there is either a value of 14, 9, 1 month or an additional variable that is based on another equation.
so either of these will show for each record displayed in the table. i need to add these shown number added
any ideas?
does that make sense?
below are a couple of lines to show what i mean
Code: Select all
<?php do {
<?php if ($row_rsPayment['payment_type'] == 'additional1'):?><?php echo round($additional1); ?><?php endif; ?>
<?php if ($row_rsPayment['payment_type'] == 'additional'):?><?php echo round($additional); ?><?php endif; ?>
<?php if ($row_rsPayment['payment_type'] == 'Option 1: Balance Before'):?>9<?php endif; ?>
<?php if ($row_rsPayment['payment_type'] == 'Option 1: Second Payment'):?>14<?php endif; ?>
<?php if ($row_rsPayment['payment_type'] == 'Option 1: Third Payment'):?>14<?php endif; ?>
<?php if ($row_rsPayment['payment_type'] == 'Option 1: Fourth Payment'):?>14<?php endif; ?>
<?php if ($row_rsPayment['payment_type'] == 'Option 2: Balance Before'):?>9<?php endif; ?>
<?php if ($row_rsPayment['payment_type'] == 'Option 2: Balance Due Loan'):?>9<?php endif; ?>
<?php if ($row_rsPayment['payment_type'] == 'Option 2: Second Payment'):?>14<?php endif; ?>
<?php if ($row_rsPayment['payment_type'] == 'Option 2: Third Payment'):?>14<?php endif; ?>
<?php if ($row_rsPayment['payment_type'] == 'Option 2: Fourth Payment'):?>14<?php endif; ?>
<?php if ($row_rsPayment['payment_type'] == 'Option 3: Month 1'):?>1 month<?php endif; ?>
} while ($row_rsPayment = mysql_fetch_assoc($rsPayment)); // && ($row_rsWeeks = mysql_fetch_assoc($rsWeeks))); ?>
so either of these will show for each record displayed in the table. i need to add these shown number added
any ideas?