Reputation:
$galleryDetails .='
<div class="col-md-3 product-left">
<p class = "tb">Total Bid: if($rowSelectCountTotal > 0){$rowSelectCountTotal}else {0}</p>
</div>
Above is my code , i try to put if else statement inside the variable but cant work,how can i put the if else inside the variable?
Upvotes: 0
Views: 34
Reputation: 13128
Simply do:
$galleryDetails .='
<div class="col-md-3 product-left">
<p class = "tb">Total Bid: '.(($rowSelectCountTotal > 0) ? $rowSelectCountTotal : 0)'.</p>
</div>
This is called Shorthand if/else, and allows you to achieve what you're trying to do.
Upvotes: 1