SA-MP Forums Archive
MySQL phpmyadmin question about INT - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: MySQL phpmyadmin question about INT (/showthread.php?tid=493789)



MySQL phpmyadmin question about INT - Riwerry - 09.02.2014

Guys what does this mean? I know when I have VARCHAR I use lenght what I need (example name is 24...)
But why when I am looking some tuts here is INT like adminlevel, money etc.. here is some number


Re: MySQL phpmyadmin question about INT - Riwerry - 10.02.2014

Why this guy used in tutorial to create this table but id with 10 length why? CREATE TABLE IF NOT EXISTS `players`(\ `ID` int(10) NOT NULL AUTO_INCREMENT


Re: MySQL phpmyadmin question about INT - PowerPC603 - 10.02.2014

If you use a program like Navicat, which allows you to connect to your databases and view your tables, you'll see that MySQL needs these values.
When designing the tables, you can input the column-name and datatype stored.
If you choose "integer", the column is created with size 11.

My MySQL package also has MySQL Workbench installed and I can ask that program to send the creation-query for any table to the output window.
This query is similar to the one you posted.

My guess is that integers are stored as text in the database-file and MySQL needs the size of that field to be able to index the tables properly.
Any unsigned integer is stored using 10 characters.
Those can go from 0 to little over 4 billion, and 4 billion written as text is 10 characters.

Unsigned integers range from little over -2 billion to little over 2 billion.
The negative sign also needs a character slot, so signed integers take 11 characters to be stored.

My scripts use "int(11)" in those queries.


Re: MySQL phpmyadmin question about INT - Vince - 10.02.2014

My god, no! Integers are saved as integers.
http://stackoverflow.com/questions/5...fter-int-int11


Re: MySQL phpmyadmin question about INT - Riwerry - 10.02.2014

If i understand correctly, I can leave INT length empty?


Re: MySQL phpmyadmin question about INT - Riwerry - 10.02.2014

Yeah, when I left it empty it automaticaly set INT(11)


Re: MySQL phpmyadmin question about INT - PowerPC603 - 10.02.2014

Quote:
Originally Posted by Vince
Посмотреть сообщение
My god, no! Integers are saved as integers.
http://stackoverflow.com/questions/5...fter-int-int11
Ah, nice info here.

I just took the 11 as default and didn't question why it was 11.
After thinking about it, 11 characters are needed to display a signed integer properly.

I never knew this was meant for programs that process the result to use this value to read the data.