Mysql If condition
$sql = "SELECT *,IF(price_promoted != null, IFNULL(price_promoted,price),IFNULL(price_promoted,price)) as amount FROM mod_digishop"; $row = self::$db->fetch_all($sql); return ($row) ? $row : 0;