The fields read as 0.00 in phpMyAdmin, but when put into an array, the value is blank, is there a way to get it to show just '0'?
From my Model:
$query = $this->db->query("SELECT t1.numberofbets, t1.profit, t2.seven_profit, t3.28profit, user.user_id, username,
PASSWORD , email, balance, user.date_added, activation_code, activated
FROM user
LEFT JOIN (
SELECT user_id, SUM( amount_won ) AS profit, COUNT( tip_id ) AS numberofbets
FROM tip
GROUP BY user_id
) AS t1 ON user.user_id = t1.user_id
LEFT JOIN (
SELECT user_id, SUM( amount_won ) AS seven_profit
FROM tip
WHERE date_settled > '$seven_daystime'
GROUP BY user_id
) AS t2 ON user.user_id = t2.user_id
LEFT JOIN (
SELECT user_id, SUM( amount_won ) AS 28profit
FROM tip
WHER开发者_如何学PythonE date_settled > '$twoeight_daystime'
GROUP BY user_id
) AS t3 ON user.user_id = t3.user_id
WHERE activated =1
GROUP BY user.user_id
ORDER BY user.date_added DESC
LIMIT 0 , 30");
return $query->result_array();
Results in the database give : '0.00' for the seven_profit column. (column is a decimal type) with print_r($array) the array looks like '[seven_profit] => ' with no value there.
I've gone with this solution for now:
if ($row['fieldname'] == ''){
$row['fieldname'] = 0;
}
Thanks
精彩评论