SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Thread Tools Display Modes
Old 12/02/2019, 03:16 PM   #1
Big Clucker
Join Date: May 2016
Posts: 101
Reputation: 0
Default MySQL Insert ID


I'm just wondering.. How do you check when Auto-Increment "ID" in mysql database reaches for example 15..
and how to set it so it will start from 0 again when next executed. Thanks in advance !
NoteND is offline   Reply With Quote
Old 12/02/2019, 03:50 PM   #2
Big Clucker
ComDuck's Avatar
Join Date: Feb 2019
Posts: 78
Reputation: 12
Default Re: MySQL Insert ID

^ shows what your next AUTO_INCREMENT value will be. Store that in a variable, and write a condition to check the value against your limit.

Besides, AUTO_INCREMENT starts from 1 and not 0 by default. To reset the AUTO_INCREMENT, perform an ALTER request for the table in question:

ALTER TABLE table_name_here AUTO_INCREMENT = 1
Even if you change the 1 to a 0, the AUTO_INCREMENT will still be set to 1 unless you modified your server settings to omit the above condition.

EDIT: Why are you doing this, by the way? Can you describe more of your situation?

Last edited by ComDuck; 12/02/2019 at 05:38 PM.
ComDuck is offline   Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
mysql INSERT INTO yellow Scripting Help 3 01/02/2014 11:20 PM
MYSQL INSERT INTO PaulDinam Scripting Help 2 22/01/2013 10:18 AM
MYSQL INSERT INTO PaulDinam Scripting Help 5 18/01/2013 12:43 PM
MySQL - INSERT INTO Rdx Scripting Help 1 10/01/2013 02:41 PM
MySQL INSERT INTO Snipa Help Archive 4 20/05/2011 01:13 AM

All times are GMT. The time now is 01:53 AM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.