$link=mysqli_connect("localhost","root","","tbl_app");
$sql="SELECT MAX(tokenno) AS max FROM tbl_order";
$result=mysqli_query($link,$sql);
while($row=mysqli_fetch_assoc($result))
$tokenaabselect=$row['max'];
echo $tokenaabselect;
Database Design:
id name tokenno
------------------
1 ram 1
2 harry 2
3 sam 6
4 ham 7
5 san 8
6 nan 9
7 hell 10
I am trying to get the maximum value from the database and i am running above code.
Now the problem, I am getting from this code is it select maximum value from tokenno as 9 where as it have to select maximum value as 10.
I don't know if the maximum value from database is 8 than it works but when maximum value on database is 10 than it select 9 or 8 the single digit highest value. I don't know what is the problem.
Please help me to select maximum value 10 from the database. Looking for positive response.