If a variable is empty, I want PHP/MySQL to assign a different value to the variable
===

Imagine this select statement in MySQL:

    SELECT table1.place, table2.person FROM table1, table2

If "place" or "person" is empty in the database (NULL or if it was mistakenly entered as an empty string of length zero), I want it to insert `null` in that variable once I get it into a PHP array...  instead, it is showing up as `string of length zero`.

The first question is, why would this be happening?

The second question is, as a fix, I was thinking to assign it a string if the DB field is a string of length zero or null - this way we are taking ownership of the issue...

What's the best fix here?

**update**

Just to add, the point here is to get this for use in Smarty.  With Smarty, isset() evaluates "true" on a string of zero length, AND it seems to evaluate true even for a NULL inside those variables, so maybe this is more of a smarty issue??

**update 2 (code)**

The SQL code:

	//form query
	$query = "select payments.id as paymentID, payments.amount, payments.account_type, applicants.*, tableb.created as batchCreated
	from payments 
	left join applicants on applicants.id = payments.applicantID
	left join tableb on tableb.id = payments.batchID
	where applicants.id = $applicantID
	LIMIT 1";

	$result = mysql_query($query);
	$row = mysql_fetch_assoc($result);