Re: [PHP-DB] Zero Values

[email protected] (Karl DeSaulniers) Thu, 3 Sep 2015 00:46:17 -0500
Newsgroups php.db
Message-ID <[email protected]>
On Sep 2, 2015, at 11:02 PM, Ethan Rosenberg <[email protected]> wrote:

> Dear list -
> 
> I know that I am making a mistake somewhere. but am lost for an answer.
> 
> mysql> select Payments  from Charges where if(Payments,  Payments, 0);
> +----------+
> | Payments |
> +----------+
> |    13.00 |
> |    55.00 |
> |    65.00 |
> |    65.00 |
> |    65.00 |
> |    65.00 |
> |   123.00 |
> |   150.00 |
> 
> mysql> select Balance, Payments, Charges from Charges where ifnull(Balance,0);
> +---------+----------+---------+
> | Balance | Payments | Charges |
> +---------+----------+---------+
> |  -13.00 |    13.00 |    0.00 |
> |  123.00 |     0.00 |  123.00 |
> |  325.00 |     0.00 |  325.00 |
> |   10.00 |     0.00 |   23.00 |
> |  270.00 |    55.00 |    0.00 |
> |   58.00 |    65.00 |    0.00 |
> |   -7.00 |    65.00 |    0.00 |
> |  -72.00 |    65.00 |    0.00 |
> 
> TIA
> 
> Ethan

Something like?

$SQL = "SELECT * FROM `Charges` 
WHERE Cust_Num=".$Cust_Num." 
AND Charges!='NULL' AND Ballance!='NULL' AND Payments!='NULL' 
ORDER BY Date ASC";

Not sure why you would have a column name the same as your database table though.
Could get confusing.  

HTH,

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com