How To Get Last Id In Database

[Solved] How To Get Last Id In Database | Php - Code Explorer | yomemimo.com
Question : mysql get the last id php

Answered by : ghislain-fievet

// Insert query
$query = "insert into users(username,fname,lname) values('sonarika','Sonarika','Bhadoria')";
mysqli_query($con,$query);
// Get last insert id
$lastid = mysqli_insert_id($con); 

Source : https://makitweb.com/get-last-insert-id-mysql-table-php/ | Last Update : Sat, 23 May 20

Question : how to get last id in database

Answered by : poor-pintail-73z17t8v2pz1

 $db = db_connect(); $query = $db->query("SELECT * FROM users ORDER BY id DESC LIMIT 1"); $result = $query->getRow();

Source : | Last Update : Fri, 20 Nov 20

Answers related to how to get last id in database

Code Explorer Popular Question For Php