SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
Thread: Maximum number of entries
-
Jan 18, 2005, 14:13 #1
- Join Date
- Jan 2000
- Location
- Scotland
- Posts
- 660
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Maximum number of entries
Hi there,
I need to be able to set the mysql db I have set up to allow a maximum number of entries of up to 17 rows - how can I do this?
-
Jan 18, 2005, 14:54 #2
- Join Date
- Jul 2002
- Location
- Toronto, Canada
- Posts
- 39,347
- Mentioned
- 63 Post(s)
- Tagged
- 3 Thread(s)
create table mytable
( id tinyint not null primary key auto_increment
, foo varchar(9)
) auto_increment=111
-
Jan 18, 2005, 16:04 #3
- Join Date
- Jan 2000
- Location
- Scotland
- Posts
- 660
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Is that 111 what I enter to make sure it can only accept 17 rows or is that a generic auto increment number?
Also, I was just requested that it be changed to 10 rows and not 17.
-
Jan 18, 2005, 16:25 #4
- Join Date
- Jul 2002
- Location
- Toronto, Canada
- Posts
- 39,347
- Mentioned
- 63 Post(s)
- Tagged
- 3 Thread(s)
the technique (it's actually more of a hack) relies on the fact that you cannot have a tinyint number greater than 127
if you want only 10 rows, declare your table with 118 as the auto_increment
Bookmarks