Implode() function error

Hi I constantly get this error:

Warning: implode() [function.implode]: Invalid arguments passed

If there is data from the database this works fine, but if there is no data I am getting data from a $_POST array, however for some reason the implode command is getting executed anyways, please look into the last line to understand what Im trying to do…

if(isset($_POST['commit']) && $_POST['commit']=="Complete"){

		$charity_q ="SELECT charity FROM signup WHERE uid ='".$_SESSION['u_id']."'";
		
		$charity_query = dbQuery($charity_q);
	
		
		$charity_2= mysql_fetch_row($charity_query);
		
		if(isset ($charity_2)){$charity_coupon = implode (' ',$charity_2);}
		else {$charity_coupon = $_POST['charity_selected'];}

What error?

just updated the post … sorry

$charity_2 is always set, even if the mysql_fetch_row returns FALSE.
Change it like this:


if ($charity_2 = mysql_fetch_row($charity_query)) {
  $charity_coupon = implode(' ', $charity_2);
} else {
  $charity_coupon = $_POST['charity_selected'];
}  

ok its working now! thanks!