Answer the question
In order to leave comments, you need to log in
How to select the value of the current auto_increment of a table?
Hello. Tell me please. Here is a table. The current value of Auto_increment = 30. This is the value I need to get. How can this be done using sql query or yii framework?
Answer the question
In order to leave comments, you need to log in
SELECT `AUTO_INCREMENT`
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = 'DatabaseName'
AND TABLE_NAME = 'TableName';
$auto = mysql_fetch_assoc(mysql_query("SHOW TABLE STATUS LIKE 'table'"));
echo $auto['auto_increment'];
Where 'table' is the name of the table.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question