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' -

Making Empty C++ Project: General exception (Exception from HRESULT:0x80131500) Visual Studio Community 2015 -

How to fix java warning for "The value of the local variable is not used " -