php变量范围外循环

I am trying to save some results within the loop and then modify the exterior variable named $hello to '123' and then outside the loop print it.

$hello = 'hi';
        // SQL //
        if ($stmt = $this->dbCon->prepare($sql)) {
            //$stmt->bind_param("s", $chainid);
            call_user_func_array(array($stmt, 'bind_param'), $params);
            $stmt->execute();
            $stmt->bind_result($sysid, $branchid, $harddiscount);
            while ($stmt->fetch()) {
                $harddiscount = number_format($harddiscount / 100, 2) . "€";

                //echo $couponname ."*".$trustanduseid."({$clientid})*".$productname."*".$chainname."*".$branchname."*".$receiptdate."*".$companyname."*".$brandname."*".$receiptid."*".$counterid."*".$discountvalue."*";
                //echo $couponname ."*".$trustanduseid."({$clientid})*".$productname."*".$chainname."*".$branchname."*".$receiptdate."*".$companyname."*".$brandname."*".$receiptid."*".$counterid."*".$harddiscount."*";

                $hello = '123';
            }
            $stmt->close();
        }

        echo $hello;

The above prints 'hi' instead of '123';

How can we I solve it?