[PHP-DB] Auto-increment questions...

2004-10-05 Thread NIPP, SCOTT V \(SBCSI\)
I am working on a database application for Unix user accounts.
I want to be able to have a system that will provide me the next
available numeric user ID.  I have created a 2 column index table that
simply includes UID and user name.  This field is autoincrement and the
primary key for the table.  Currently this field only contains a very
small sample of users.  Basically, I have numeric IDs 3000, 3001, 3008,
and 3028.  My problem is that I am not sure how to query this table to
get the next available numeric ID which is 3002.  If I do an insert into
this table without specifying a value for the auto_increment column it
comes up with 3029.  Is there a way to query and/or insert such that it
comes up with the next unused numeric value?

Scott Nipp
Phone:  (214) 858-1289
E-mail:  [EMAIL PROTECTED]
Web:  http:\\ldsa.sbcld.sbc.com

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Auto-increment questions...

2004-10-05 Thread NIPP, SCOTT V \(SBCSI\)
OK.  The problem is I don't want the next highest number.
There are gaps in the UID sequence.  I need to find the next UNUSED
number in the sequence which is rarely the highest number.

Scott Nipp
Phone:  (214) 858-1289
E-mail:  [EMAIL PROTECTED]
Web:  http:\\ldsa.sbcld.sbc.com



-Original Message-
From: Bastien Koert [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 05, 2004 12:45 PM
To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Auto-increment questions...


If its an autoincrement, the next highest number will be assigned by the
db. 
There is no need to query the db to find it. Simply insert the record
and 
leave the id field out of the insert statement.

bastien


From: NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Auto-increment questions...
Date: Tue, 5 Oct 2004 11:58:41 -0500

   I am working on a database application for Unix user accounts.
I want to be able to have a system that will provide me the next
available numeric user ID.  I have created a 2 column index table that
simply includes UID and user name.  This field is autoincrement and the
primary key for the table.  Currently this field only contains a very
small sample of users.  Basically, I have numeric IDs 3000, 3001, 3008,
and 3028.  My problem is that I am not sure how to query this table to
get the next available numeric ID which is 3002.  If I do an insert
into
this table without specifying a value for the auto_increment column it
comes up with 3029.  Is there a way to query and/or insert such that it
comes up with the next unused numeric value?

Scott Nipp
Phone:  (214) 858-1289
E-mail:  [EMAIL PROTECTED]
Web:  http:\\ldsa.sbcld.sbc.com

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


_
Scan and help eliminate destructive viruses from your inbound and
outbound 
e-mail and attachments. 
http://join.msn.com/?pgmarket=en-capage=byoa/premxAPID=1994DI=1034SU
=http://hotmail.com/encaHL=Market_MSNIS_Taglines 
  Start enjoying all the benefits of MSN(r) Premium right now and get
the 
first two months FREE*.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Auto-increment questions...

2004-10-05 Thread Hutchins, Richard
As a record ID, you shouldn't really worry about the numbers being
sequential without gaps - they're just a way of assigning a unique number to
a record in the db. However, if you need the record's id to be sequential
because you're going to use it as a piece of actual data to be displayed to
your users then maybe you may want to consider adding a field to the
database that you can manipulate and check for sequence and gaps.

If your requirements specifically state that the record ids must be
sequential then I guess you don't have a choice. But if having sequential
ids is your personal preference, you may find that you're making life more
difficult on yourself than it has to be.

Also, I know this topic has come up in the past and has been discussed at
length. You may want to check the archives to see what others have posted.

Rich


 -Original Message-
 From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, October 05, 2004 2:00 PM
 To: Bastien Koert; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] Auto-increment questions...
 
 
   OK.  The problem is I don't want the next highest number.
 There are gaps in the UID sequence.  I need to find the next UNUSED
 number in the sequence which is rarely the highest number.
 
 Scott Nipp
 Phone:  (214) 858-1289
 E-mail:  [EMAIL PROTECTED]
 Web:  http:\\ldsa.sbcld.sbc.com
 
 
 
 -Original Message-
 From: Bastien Koert [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, October 05, 2004 12:45 PM
 To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] Auto-increment questions...
 
 
 If its an autoincrement, the next highest number will be 
 assigned by the
 db. 
 There is no need to query the db to find it. Simply insert the record
 and 
 leave the id field out of the insert statement.
 
 bastien
 
 
 From: NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Auto-increment questions...
 Date: Tue, 5 Oct 2004 11:58:41 -0500
 
  I am working on a database application for Unix user accounts.
 I want to be able to have a system that will provide me the next
 available numeric user ID.  I have created a 2 column index 
 table that
 simply includes UID and user name.  This field is 
 autoincrement and the
 primary key for the table.  Currently this field only contains a very
 small sample of users.  Basically, I have numeric IDs 3000, 
 3001, 3008,
 and 3028.  My problem is that I am not sure how to query 
 this table to
 get the next available numeric ID which is 3002.  If I do an insert
 into
 this table without specifying a value for the auto_increment 
 column it
 comes up with 3029.  Is there a way to query and/or insert 
 such that it
 comes up with the next unused numeric value?
 
 Scott Nipp
 Phone:  (214) 858-1289
 E-mail:  [EMAIL PROTECTED]
 Web:  http:\\ldsa.sbcld.sbc.com
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 _
 Scan and help eliminate destructive viruses from your inbound and
 outbound 
 e-mail and attachments. 
 http://join.msn.com/?pgmarket=en-capage=byoa/premxAPID=1994;
DI=1034SU
=http://hotmail.com/encaHL=Market_MSNIS_Taglines 
  Start enjoying all the benefits of MSN(r) Premium right now and get
the 
first two months FREE*.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Auto-increment questions...

2004-10-05 Thread Daniel Brunner
What determines the gaps???
On Oct 5, 2004, at 12:59 PM, [EMAIL PROTECTED] wrote:
OK.  The problem is I don't want the next highest number.
There are gaps in the UID sequence.  I need to find the next UNUSED
number in the sequence which is rarely the highest number.
Scott Nipp
Phone:  (214) 858-1289
E-mail:  [EMAIL PROTECTED]
Web:  http:\\ldsa.sbcld.sbc.com

-Original Message-
From: Bastien Koert [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 05, 2004 12:45 PM
To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Auto-increment questions...
If its an autoincrement, the next highest number will be assigned by  
the
db.
There is no need to query the db to find it. Simply insert the record
and
leave the id field out of the insert statement.

bastien

From: NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Auto-increment questions...
Date: Tue, 5 Oct 2004 11:58:41 -0500
	I am working on a database application for Unix user accounts.
I want to be able to have a system that will provide me the next
available numeric user ID.  I have created a 2 column index table that
simply includes UID and user name.  This field is autoincrement and  
the
primary key for the table.  Currently this field only contains a very
small sample of users.  Basically, I have numeric IDs 3000, 3001,  
3008,
and 3028.  My problem is that I am not sure how to query this table to
get the next available numeric ID which is 3002.  If I do an insert
into
this table without specifying a value for the auto_increment column it
comes up with 3029.  Is there a way to query and/or insert such that  
it
comes up with the next unused numeric value?

Scott Nipp
Phone:  (214) 858-1289
E-mail:  [EMAIL PROTECTED]
Web:  http:\\ldsa.sbcld.sbc.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
_
Scan and help eliminate destructive viruses from your inbound and
outbound
e-mail and attachments.
http://join.msn.com/?pgmarket=en-capage=byoa/ 
premxAPID=1994DI=1034SU
=http://hotmail.com/encaHL=Market_MSNIS_Taglines
  Start enjoying all the benefits of MSN(r) Premium right now and get
the
first two months FREE*.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Auto-increment questions...

2004-10-05 Thread Andrew Kreps
On Tue, 5 Oct 2004 12:59:55 -0500, NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED] wrote:
 OK.  The problem is I don't want the next highest number.
 There are gaps in the UID sequence.  I need to find the next UNUSED
 number in the sequence which is rarely the highest number.

As far as I know, you'll have to write a little function to do that
for you.  I don't know of a built-in database function that does what
you require.  Assuming your application is PHP, Something such as this
might work (pardon the shorthand):

function getNextMissing () 
{
  $result = select id from the_table order by id;
  while (list ($id) = mysql_fetch)
  {
if (isset ($lastId)  ($lastId  $id - 1))
{
$returnVal = $lastId + 1;
 }
 $lastId = $id;  
  }
  return $returnVal;
}

You'll need to modify the function to handle there being no gaps in
the sequence (i.e. return $id + 1 if you never hit the logic in the
if), or for that matter, there being no id's.  Otherwise, I think it's
a good starting point.  Good luck!

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Auto-increment questions...

2004-10-05 Thread Andrew Kreps
On Tue, 5 Oct 2004 14:18:55 -0700, Andrew Kreps [EMAIL PROTECTED] wrote:
 if (isset ($lastId)  ($lastId  $id - 1))
 {
 $returnVal = $lastId + 1;
  }

Sorry, I left a bit of a bug in there.  You should exit the loop at
this point, if you've found a gap.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Auto-increment questions...

2004-10-05 Thread John Holmes
NIPP, SCOTT V (SBCSI) wrote:
I am working on a database application for Unix user accounts.
I want to be able to have a system that will provide me the next
available numeric user ID.  I have created a 2 column index table that
simply includes UID and user name.  This field is autoincrement and the
primary key for the table.  Currently this field only contains a very
small sample of users.  Basically, I have numeric IDs 3000, 3001, 3008,
and 3028.  My problem is that I am not sure how to query this table to
get the next available numeric ID which is 3002.  If I do an insert into
this table without specifying a value for the auto_increment column it
comes up with 3029.  Is there a way to query and/or insert such that it
comes up with the next unused numeric value?
Why on Earth would you want to do that? Do you have a genuine reason?
The whole point of auto_increment columns is that you do not need to 
reuse the ID numbers. Using an UNSIGNED INT column, there can be 
4294967295 values. Do you really expect to go over that? If so, an 
UNSIGNED BIGINT can have 18446744073709551615 values. If you think 
you're going to go over that, you're f'n crazy.

Do not worry about holes in the sequence. If you application depends 
upon sequential numbers, then you've written it wrong and it's using the 
auto_increment column for the wrong purpose.

There are good reasons, too. If you delete user 3000 and the next user 
gets that UserID, now anything left over from the old user 3000 is now 
related/linked to the new user 3000. How do you even tell there was an 
old user 3000? Wouldn't you want to be able to detect that? I'm sure 
there are other reasons, too...

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Auto Increment

2002-10-07 Thread Gavin Nouwens

Hi peoples,

Just wondering if it's possible with mysql to start an auto-increment field
at a specified number instead of 0001?

I could always just code it in php to add another number onto it to get it
to the right start point, but leaves areas for human error to creep in!

Any help would be appreciated!

-gav.


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Auto Increment

2002-10-07 Thread Mark Nenadov

On October 8, 2002 01:49 am, Gavin Nouwens wrote:
 Hi peoples,

 Just wondering if it's possible with mysql to start an auto-increment field
 at a specified number instead of 0001?

 I could always just code it in php to add another number onto it to get it
 to the right start point, but leaves areas for human error to creep in!

 Any help would be appreciated!

 -gav.

Gavin,

One way to approach this is to manual insert one record with the number you 
want.

So, just add a dummy field with an id of 49 for example.. Then the next 
record you insert will be 50.

-- 
Mark Nenadov,
Freelance Software Developer
web: www.freelance-developer.com
e-mail [EMAIL PROTECTED]


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] Auto Increment

2002-10-07 Thread John W. Holmes

CREATE TABLE table_name (ID INT NOT NULL AUTO_INCREMENT = 1 PRIMARY
KEY, ... );

---John Holmes...

 -Original Message-
 From: Gavin Nouwens [mailto:[EMAIL PROTECTED]]
 Sent: Monday, October 07, 2002 9:50 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Auto Increment
 
 Hi peoples,
 
 Just wondering if it's possible with mysql to start an auto-increment
 field
 at a specified number instead of 0001?
 
 I could always just code it in php to add another number onto it to
get it
 to the right start point, but leaves areas for human error to creep
in!
 
 Any help would be appreciated!
 
 -gav.
 
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Auto Increment Problems....

2002-07-29 Thread Daniel Brunner

Once again...


ALTER TABLE table1 AUTO_INCREMENT = 500


Dan



On Monday, July 29, 2002, at 10:44 PM, [EMAIL PROTECTED] wrote:

 rite,

 my primary key column (id) is set to auto_increment as usual which is 
 very
 handy. But when I delete a row, the auto_increment just keeps 
 incrementing
 and there's this 'hole' left where I deleted the row!

 Apart from this looking ugly, it poses another problem. In my PHP script
 where I can add new rows, I query the table, checking how many rows in 
 the
 table altogether and set the new id as the next number, but this doesnt 
 work
 if theres 'holes' in the id field, as the new record tries to overwrite
 another id.

 So I've 2 questions
 1) Can the next auto_increment value be 'set' by a SQL query
 2) Can I get a SQL query to INSERT INTO the first 'hole' it finds in 
 the ID
 column??

 TIA



 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Auto Increment Problems....

2002-07-29 Thread Georgie Casey

why, is this question asked a lot??? anywa, thanks, i was gonna try
something like that from something i read in the mysql manual, but it only
mentioned it passing and didnt give an example or anything.

tanx

Daniel Brunner [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Once again...


 ALTER TABLE table1 AUTO_INCREMENT = 500


 Dan



 On Monday, July 29, 2002, at 10:44 PM, [EMAIL PROTECTED] wrote:

  rite,
 
  my primary key column (id) is set to auto_increment as usual which is
  very
  handy. But when I delete a row, the auto_increment just keeps
  incrementing
  and there's this 'hole' left where I deleted the row!
 
  Apart from this looking ugly, it poses another problem. In my PHP script
  where I can add new rows, I query the table, checking how many rows in
  the
  table altogether and set the new id as the next number, but this doesnt
  work
  if theres 'holes' in the id field, as the new record tries to overwrite
  another id.
 
  So I've 2 questions
  1) Can the next auto_increment value be 'set' by a SQL query
  2) Can I get a SQL query to INSERT INTO the first 'hole' it finds in
  the ID
  column??
 
  TIA
 
 
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Auto Increment Problems....

2002-07-29 Thread Daniel Brunner

Yeah, it's asked a lot!!

And I've always answered that question( it's not the only question I 
answer!!! )


But Good Luck!! And your welcome!!!


Dan


On Monday, July 29, 2002, at 10:51 PM, [EMAIL PROTECTED] wrote:

 why, is this question asked a lot??? anywa, thanks, i was gonna try
 something like that from something i read in the mysql manual, but it 
 only
 mentioned it passing and didnt give an example or anything.

 tanx

 Daniel Brunner [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Once again...


 ALTER TABLE table1 AUTO_INCREMENT = 500


 Dan



 On Monday, July 29, 2002, at 10:44 PM, [EMAIL PROTECTED] wrote:

 rite,

 my primary key column (id) is set to auto_increment as usual which 
 is
 very
 handy. But when I delete a row, the auto_increment just keeps
 incrementing
 and there's this 'hole' left where I deleted the row!

 Apart from this looking ugly, it poses another problem. In my PHP 
 script
 where I can add new rows, I query the table, checking how many rows in
 the
 table altogether and set the new id as the next number, but this 
 doesnt
 work
 if theres 'holes' in the id field, as the new record tries to 
 overwrite
 another id.

 So I've 2 questions
 1) Can the next auto_increment value be 'set' by a SQL query
 2) Can I get a SQL query to INSERT INTO the first 'hole' it finds in
 the ID
 column??

 TIA



 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php





 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Auto Increment Problems....

2002-07-29 Thread Raquel Rice

On Mon, 29 Jul 2002 20:44:54 -0700
Georgie Casey Georgie Casey [EMAIL PROTECTED] wrote:

 rite,
 
 my primary key column (id) is set to auto_increment as usual
 which is very
 handy. But when I delete a row, the auto_increment just keeps
 incrementing
 and there's this 'hole' left where I deleted the row!
 
 Apart from this looking ugly, it poses another problem. In my PHP
 script
 where I can add new rows, I query the table, checking how many
 rows in the
 table altogether and set the new id as the next number, but this
 doesnt work
 if theres 'holes' in the id field, as the new record tries to
 overwrite
 another id.
 
 So I've 2 questions
 1) Can the next auto_increment value be 'set' by a SQL query
 2) Can I get a SQL query to INSERT INTO the first 'hole' it finds
 in the ID
 column??
 
 TIA

Why do you want to create your own ID when one is created for you
automatically?

If you want to know how many rows are in a table, you can use
SELECT COUNT(*) FROM table (at least using MySQL).

If you need the ID of the last row inserted to be able to stick that
ID into another table, using PHP, try mysql_insert_id().

-- 
Raquel

Happiness is not the absence of conflict; it is the ability to cope
with it.
  --Unknown


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] Auto Increment Problems....

2002-07-29 Thread Georgie Casey

rite,

my primary key column (id) is set to auto_increment as usual which is very
handy. But when I delete a row, the auto_increment just keeps incrementing
and there's this 'hole' left where I deleted the row!

Apart from this looking ugly, it poses another problem. In my PHP script
where I can add new rows, I query the table, checking how many rows in the
table altogether and set the new id as the next number, but this doesnt work
if theres 'holes' in the id field, as the new record tries to overwrite
another id.

So I've 2 questions
1) Can the next auto_increment value be 'set' by a SQL query
2) Can I get a SQL query to INSERT INTO the first 'hole' it finds in the ID
column??

TIA



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] auto increment

2002-06-14 Thread Howard Picken

If you run an optimize or a repair on your datafile
it'll set the autoincrememtn back to next number

Howard

-Original Message-
From: Daniele Baroncelli [mailto:[EMAIL PROTECTED]]
Sent: Friday, 14 June 2002 11:27 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] auto increment


Hi guys,

The auto_increment field of my MySQL table gives me 258, although the
higher value at the moment is 241.

I deleted the latest records, thinking that also the auto_increment would
decrease, but this is not.

I would like to know if there is a way to bring the auto_increment back to
the higher value + 1.


Cheers

Daniele




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] auto increment

2002-06-14 Thread José Moreira

hello, i think u have to create the series yourself ... before u insert
every record, first calculate the next value :
SELECT MAX(ID) AS NEXT FROM TABLE

then u insert ...

hope it helps ...


-Mensagem original-
De: Daniele Baroncelli [mailto:[EMAIL PROTECTED]]
Enviada: sexta-feira, 14 de Junho de 2002 2:27
Para: [EMAIL PROTECTED]
Assunto: [PHP-DB] auto increment


Hi guys,

The auto_increment field of my MySQL table gives me 258, although the
higher value at the moment is 241.

I deleted the latest records, thinking that also the auto_increment would
decrease, but this is not.

I would like to know if there is a way to bring the auto_increment back to
the higher value + 1.


Cheers

Daniele




--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] auto increment

2002-06-14 Thread Daniel Brunner

Hello!!

ALTER TABLE $table1 AUTO_INCREMENT = 242

Replace the $table with your table's name and replace the end number 
with what number you want.

Dan


On Thursday, June 13, 2002, at 08:27 PM, [EMAIL PROTECTED] wrote:

 Hi guys,

 The auto_increment field of my MySQL table gives me 258, although the
 higher value at the moment is 241.

 I deleted the latest records, thinking that also the auto_increment 
 would
 decrease, but this is not.

 I would like to know if there is a way to bring the auto_increment back 
 to
 the higher value + 1.


 Cheers

 Daniele




 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] auto increment

2002-06-13 Thread Daniele Baroncelli

Hi guys,

The auto_increment field of my MySQL table gives me 258, although the
higher value at the moment is 241.

I deleted the latest records, thinking that also the auto_increment would
decrease, but this is not.

I would like to know if there is a way to bring the auto_increment back to
the higher value + 1.


Cheers

Daniele




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] auto-increment question

2002-04-23 Thread Dan Swensen

Hi all,

I'm wondering if there is a way to start an auto-increment field at a number 
other than 1. I'm working on a table meant to store large amounts of users, 
each with their own unique ID, but my employer wants the UIDs to be a four-
digit number, rather than starting at 1 -- but they still need to auto-
increment. Can this be done, or do I need to find a workaround (and if so, 
can anyone suggest anything?)

Thanks in advance,

Dan

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] auto-increment question

2002-04-23 Thread szii

This is more of a MySQL question, but you can set the column default for
the auto_increment column to something other than 1.

Look up the SET DEFAULT clause of the table create / alter table
calls.

-Szii

- Original Message - 
From: Dan Swensen [EMAIL PROTECTED]
To: php [EMAIL PROTECTED]
Sent: Monday, April 22, 2002 10:21 PM
Subject: [PHP-DB] auto-increment question


 Hi all,
 
 I'm wondering if there is a way to start an auto-increment field at a number 
 other than 1. I'm working on a table meant to store large amounts of users, 
 each with their own unique ID, but my employer wants the UIDs to be a four-
 digit number, rather than starting at 1 -- but they still need to auto-
 increment. Can this be done, or do I need to find a workaround (and if so, 
 can anyone suggest anything?)
 
 Thanks in advance,
 
 Dan
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] auto-increment question

2002-04-23 Thread Dan Brunner

Hello!!

ALTER TABLE table1 AUTO_INCREMENT = 1000;

That should do it...

You can use that anytime..

Dan

On Tuesday, April 23, 2002, at 12:21 AM, [EMAIL PROTECTED] wrote:

 Hi all,

 I'm wondering if there is a way to start an auto-increment field at a 
 number
 other than 1. I'm working on a table meant to store large amounts of 
 users,
 each with their own unique ID, but my employer wants the UIDs to be a 
 four-
 digit number, rather than starting at 1 -- but they still need to auto-
 increment. Can this be done, or do I need to find a workaround (and if 
 so,
 can anyone suggest anything?)

 Thanks in advance,

 Dan

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php