I have this code presently for null to say free but i need also if the info in the ProductPrice field is 0

echo is_null($row['ProductPrice']) ? "FREE" : $row['ProductPrice'];
	echo "</td><td>";

Please help

Recommended Answers

All 6 Replies

The code segment seems correct. Are you tried with empty() instead of is_null()?

would that not make every price free?

This conditional, if $row is null or empty, the text "free" will always be displayed.

it need to be if it is NULL or 0 (as in ZERO) please , please can you give full code.

Thanks again

echo empty($row['ProductPrice']) ? "FREE" : $row['ProductPrice'];
	echo "</td><td>"

perfect thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.