Adamhumbug Posted July 6, 2020 Share Posted July 6, 2020 (edited) Hi All, I have a prepared statement which give me a bound result $pom If the value is NULL i would like the output to be "EVEN" if it is not null i would like it to equal itself with a poundsign infront. I have the following: $stmt -> bind_result($pom); while($stmt -> fetch()){ $pom = "£{$pom}" ?? "Even"; $out .= "<div>$pom</div>"; } return $out; I have found that whatever the outcome, it is the same on each row. I either get the £ sign or i dont for everything. If i remove the £ completely to the following, it works perfectly. $pom = $pom ?? "Even"; Edited July 6, 2020 by Adamhumbug Quote Link to comment Share on other sites More sharing options...
requinix Posted July 6, 2020 Share Posted July 6, 2020 "£{$pom}" ?? "Even"; "£{$pom}" is a string. It will never, ever be null. It may be a shock to you, but the ?? operator is not the right hammer for this screw. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.