我需要从“topicid”列中获取最高数字,下面的代码段似乎工作正常,但想知道是否有更好的解决方案,也许没有 while 循环?
<?php
$tquery = "SELECT MAX(topicid) FROM post";
$tresult = mysqli_query($connect,$tquery);
while($row = mysqli_fetch_array($tresult)){
$topidcount = $row['MAX(topicid)'] +1;
?>
<input type="hidden" name="topicid" value="<?php echo $topidcount;?>" />
<?php
}
?>