我想如果它显示0条评论:'0条评论',当有2条评论时,它会显示“2评论”。但是当有在线1评论显示在结尾时没有S的'1评论'。
我该怎么做?
$counting = mysql_num_rows(mysql_query("SELECT * FROM `news` WHERE `postid`='".$data['id']."'"));
答案 0 :(得分:0)
<?php
if ($counting>1)
echo $counting . ' comments';
else
echo $counting . ' comment';
答案 1 :(得分:0)
echo ($counting == 1 ? $counting . " comment" : $counting . " comments")