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

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -