while displaying address from database I have added , at the end of each value. when last value of address in empty am getting , along with the last value. But I don’t want that. Can any one help?
if ($Fetch['addr']!=''){
echo $Fetch['addr'].',';
it is displaying
address,city,postalcode
if i remove postalcode it displayes
address,city,
but i don’t need , at the end when any of the value is not provided
Store the output in a variable do not echo directly with
ifas you are doing and then use below function and finally print them after applyingrtrimon the$str.string should be stored in
$strwith all theif‘sThis will remove last comma