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
Post a Comment