FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Storing large integer in MySQL database





Gregoric
Hi there

I need to store great numbers in my database and I have a question about how to do that as I am rookie in these things...

The integer has 17 number characters and when I am trying to store it as type INT, it stores only the biggest available number; 214something. Temporarily I set the type to VARCHAR but I suppose there's another way to insert so great numbers into my database.

Any suggestions?
Josso
Well I don't know much SQL I'm afraid but was it 2,147,483,647?

According to this site I am looking at bigint stores up to 9,223,372,036,854,775,807
Gregoric
Probably yes.

Well, I will try using the BIGINT you mentioned, thanks. This is better way to store the numbers, I hope? In my database, those large numbers won't change, will only be entered once and then PHP will only read them.

I mean, if it is better than VARCHAR?
Josso
I suppose if they don't change yeah you could use varchar even though the data type is like... unicode? Mind you if the values are never going to change you might as well read them off a txt file or something.
Gregoric
Josso wrote:
I suppose if they don't change yeah you could use varchar even though the data type is like... unicode? Mind you if the values are never going to change you might as well read them off a txt file or something.


MySQL is easier to access and I will use few more tables of data so storing all the things in the database is better idea. I will read a bit about the BIGINT to ensure that's the thing I am searching for.

Now gotta solve some problems with making my login system secure Smile. Well thanks for answers, write again if you'll have some new suggestions about the case.
Bondings
@18446744073709551615, BIGINT is the thing to use if you want bigger integers than the normal INT. Of course if you need even bigger numbers, then you'll have to look for other solutions.

By the way, if you only need to store positive integers, go for unsigned ones, then you can reach 18446744073709551615.

You can find some information about them here: http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html .
Related topics
Cron Job to Backup MySQL Database
Mysql database problem
PHPBB MYSQL Database Question.
MySQL database for a forum
Mysql database size?
Connect to MySql database
[MySQL database] Password and username
insert data to mySQL database problem
MySQL Database!?
Delete data from MySQL database problem!!
MySQL database
Problem connecting to MySQL database with PHP [RESOLVED]
Inserting PHP multidimensional arrays into a mySQL database
Creating safe persistent login system
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.