我有以下声明,但我想做的是找出一种方法来判断它是否返回了空插入N/A
。我会使用 if 语句还是在数据库中设置默认值?
代码:
$query = $this->db->query("SELECT f.film_id 'Film ID', f.film_name 'Film Name', u.user_first_name 'First Name', u.user_surname 'Surname', u.user_address_line1 'Address1', u.user_address_line2 'Address2', u.user_towncity 'City', u.user_us_state_id 'US State', u.user_non_us_state_county 'Non US State', u.user_country 'Country' FROM films f
INNER JOIN users u ON u.user_id = f.user_id WHERE f.active = 0");
return $query;