Assign Max() MySQL command to a variable in PHP -
Assign Max() MySQL command to a variable in PHP -
in mysql database, insert entry db, , need number of lastly insertion. have set auto-increment. using query "select max(id) table;" works fine in database, need capture number variable in php.
$rowsql = mysqli_query($con, "select max(id) table"); $row = mysqli_fetch_assoc($rowsql); $largestuid = $row['max']; echo $largestuid;
thanks help!
use as
modifier in query. modifier gives selected items alias.
$rowsql = mysqli_query($con, "select max(id) maxid table"); $row = mysqli_fetch_assoc($rowsql); $largestuid = $row['maxid']; echo $largestuid;
php mysql sql mysqli
Comments
Post a Comment