我使用PHP代碼中的SQL查詢來顯示網站上數據庫的字段。有沒有辦法在空(NULL)字段的輸出中刪除空格(空格)?不顯示空格
這裏是我的代碼:
<?php
$sql = "SELECT * FROM dining ORDER BY date DESC LIMIT 0, 3";
$dining = new Database($sql);
while($dining->results()){
echo "
<span class='date'>". date("F jS, Y", strtotime($dining->date)) ."</span>
<h3> $dining->title</h3>
<h4> $dining->Comforts</h4>
$dining->com1<br/>
$dining->com2<br/>
$dining->com3<br/>
$dining->com4<br/>
$dining->com5<br/>
$dining->com6<br/>
<h4> $dining->Breakers</h4>
$dining->break1<br/>
$dining->break2<br/>
<h4> $dining->Wild</h4>
$dining->wild1<br/>
$dining->wild2<br/>
<h4> $dining->Tureens</h4>
$dining->tur1<br/>
$dining->tur2<br/>
$dining->tur3<br/>
<h4> $dining->Desserts</h4>
$dining->des1<br/>
$dining->des2<br/>
$dining->des3<br/>
$dining->des4<br/><br/>
";
}
?>
空間和空白空間有什麼區別? –