Aoshi
04-02-2001, 04:06 PM
I have a mySQL table called users.
i'm inserting rows to it through a webpage.
two behaviors i'm noticing.
1) ...sometimes..after i've inserted a couple of new rows, the rows will show up in reverse order. The first column of my table is a user_id column with the auto_increment attribute. so...sometimes...I havne't been able to consistently reproduce this...but sometimes i'll add a few rows and then look at the table and it'll look like:
user_id[nbsp][nbsp]name[nbsp][nbsp]
5[nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp]james
4[nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp]jimbo
3[nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp]jimmy
any ideas?
the second behavior is documented in my mysql book, but it doesn't offer a resolution....perhaps there isnt' any?
so my first column is an auto_incremented column.
when i delete a row from the table, the user_id value that i deleted is never used again.
so if i had 5 users in my table listed 1 through 5....and i then deleted each row so that my table is empty, and then i added a new user...that new user will show up as user 6.
is there any way to get it to start over at 1?
the only way i found is to go into mysql and issue this query "DELETE FROM users";
that will allow me to start back at 1 for the user_id...but obviously..that kills all the existing records.
Thanks!
-James
i'm inserting rows to it through a webpage.
two behaviors i'm noticing.
1) ...sometimes..after i've inserted a couple of new rows, the rows will show up in reverse order. The first column of my table is a user_id column with the auto_increment attribute. so...sometimes...I havne't been able to consistently reproduce this...but sometimes i'll add a few rows and then look at the table and it'll look like:
user_id[nbsp][nbsp]name[nbsp][nbsp]
5[nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp]james
4[nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp]jimbo
3[nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp]jimmy
any ideas?
the second behavior is documented in my mysql book, but it doesn't offer a resolution....perhaps there isnt' any?
so my first column is an auto_incremented column.
when i delete a row from the table, the user_id value that i deleted is never used again.
so if i had 5 users in my table listed 1 through 5....and i then deleted each row so that my table is empty, and then i added a new user...that new user will show up as user 6.
is there any way to get it to start over at 1?
the only way i found is to go into mysql and issue this query "DELETE FROM users";
that will allow me to start back at 1 for the user_id...but obviously..that kills all the existing records.
Thanks!
-James