php - How to put an if statement inside a variable? -


$gallerydetails .='         <div class="col-md-3 product-left">    <p class = "tb">total bid: if($rowselectcounttotal > 0){$rowselectcounttotal}else {0}</p> </div> 

above code , try put if else statement inside variable cant work,how can put if else inside variable?

simply do:

$gallerydetails .='         <div class="col-md-3 product-left">    <p class = "tb">total bid: '.(($rowselectcounttotal > 0) ? $rowselectcounttotal : 0)'.</p> </div> 

this called shorthand if/else, , allows achieve you're trying do.


Comments

Popular posts from this blog

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -