I want to make sure my total does not go down below 0.... so it it's -1 or something I want to reset it to 0. Is this code right?

$QNT = $row2['Quantity'] - 1;
if ($QNT <= '0'){
$QNT = 0;
}

    Yes, but I would write it as:

    $QNT = $row2['Quantity'] - 1;
    if ($QNT < 0) {
        $QNT = 0;
    }

    After all, if it is already 0, there is no need to set it to 0, and then since you are comparing numbers, there is no need to use a string literal.

      Write a Reply...