Need help with ELSE statement
Hi, I am creating and IF/ELSE statement. I want the IF statement to ask for one specific condition to be met, and if that condition is not met, there will be an ELSE statement run instead. My only problem is how do I get this query to run the ELSE statement once. At the moment, using my query below it will run the ELSE statement for each field in the database with contact_id=$mye_id as specified in my query here but where $contribution_type_id does not equal '8', as in the part of my query lower down. How can I change this so the ELSE statement only runs the once?
$query = "SELECT contact_id, contribution_type_id FROM civicrm_contribution WHERE contact_id=$mye_id";
$result = mysql_query($query) or die('Error, list committee members failed. ' . mysql_error());
while(list($contact_id, $contribution_type_id) = mysql_fetch_array($result))
if ($contact_id === $mye_id AND $contribution_type_id === '8')
echo 'First statement';
echo 'Second statement';