I need to get the highest number from "topicid" column, the snippet below seems to work fine but was wondering if there is a better solution, maybe without the while loop?
<?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
}
?>