Re: Re: May i?
| From: | Andy Woolley | Date: | Mon, 05 Aug 2002 20:22:19 +0000 |
| Subject: | Re: Re: May i? | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-111255@lists.php.net to get a copy of this message | ||
Try this
ALTER TABLE tbl_name AUTO_INCREMENT=1;
This should reset the auto_inc pri_key field but be very careful with this,
Maxim's theory on id continuity is an important factor as your data may not
have the sequence it needs for left joins etc.
Hope this helps
Andy.
----- Original Message -----
From: "Monty" <monty3@hotmail.com>
To: <php-general@lists.php.net>
Sent: Monday, August 05, 2002 9:13 PM
Subject: Re: [PHP] Re: May i?
> There doesn't appear to be any way to reset the internal MySQL
> auto-numbering sequence. Only way I know to do this is re-create your
table
> and re-import any data you want into the new table after testing is done.
>
> If you are storing data in other tables linked by the ID field, then you
> simply have to write the code that will automatically delete any related
> records from all tables to keep your database in-sync.
>
> Monty
>
> > From: flavinho@cantv.net (::: Flavio Bastos Amiel::::::>)
> > Newsgroups: php.general
> > Date: Tue, 3 Sep 2002 21:08:57 -0400
> > To: php-general@lists.php.net
> > Subject: Re: [PHP] Re: May i?
> >
> > well....... yes, then maybe i made a mistake.... there was data related
to
> > the id ..... then i delete that row.... and the data that was related to
the
> > comments are gone away, because the row id has changed....so i would
have to
> > put then manually again....
> >
> > Flavio Bastos Amiel
> >
> >
> > "Maxim Maletsky" <subscriptions@phpbeginner.com> wrote in message
> > news:000c01c23b50$050fcfe0$1113fe17@dominanta...
> >>
> >> Why do you need it anyway?
> >>
> >> auto_increment is a mySQL functionality to (listen this carefully) KEEP
> >> UNICITY WITHIN A TABLE. This is what they are needed for. I agree - it
> >> would look prettier having them even sequential, but that is behind the
> >> real point and it is not a "problem".
> >>
> >> You should make your application independent from "id" value -
> >> "id"
> >> should only serve you as a key to relate the data within
> >> application/database.
> >>
> >>
> >> Sincerely,
> >>
> >> Maxim Maletsky
> >>
> >> PHP Beginner
> >> www.phpbeginner.com
> >>
> >>
> >>> -----Original Message-----
> >>> From: ::: Flavio Bastos Amiel::::::> [mailto:flavinho@cantv.net]
> >>> Sent: Wednesday, September 04, 2002 2:28 AM
> >>> To: php-general@lists.php.net
> >>> Subject: [PHP] Re: May i?
> >>>
> >>> let's see if i can do it...
> >>>
> >>> i got a news site..... everything was going OK....sometimes i made few
> >>> testing and then i delete the content from the db... the problem is
> >> next:
> >>>
> >>> the item "id" is an auto_increment element .. so the id's
> >>> wasn't going
> >>> allright....because they where not true... sometimes they make jumps
> >> like
> >>> id
> >>> #25 and the id #30 (because of the testing i've done and then delete)
> >>>
> >>> i tried to delete that cell (id) and then i recreate it. thinking the
> >> id
> >>> was
> >>> going to count it all over and make the item id TRUE.....but it wasn't
> >>> like
> >>> that, the "new" id was counting since the last id then if the last id
> >> was
> >>> 100, the new id was counting from 100 to 200 .... do i explain
> >> myself?...
> >>> does anyone have an answer to this problem (PLEASE Dont tell me i have
> >> to
> >>> do
> >>> i manually!! )
> >>>
> >>> thanks,
> >>> Flavio Bastos Amiel
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> "George Nicolae" <geomasterweb@hotmail.com> wrote in message
> >>> news:20020804001037.31489.qmail@pb1.pair.com...
> >>>> ask.
> >>>>
> >>>> --
> >>>>
> >>>>
> >>>> Best regards,
> >>>> George Nicolae
> >>>> IT Manager
> >>>> ___________________
> >>>> PaginiWeb.com - Professional Web Design
> >>>> www.PaginiWeb.com
> >>>>
> >>>>
> >>>> "::: Flavio Bastos Amiel::::::>" <flavinho@cantv.net> wrote
> >>>> in
> >> message
> >>>>
> >>>> news:20020803224811.95593.qmail@pb1.pair.com...
> >>>>> May i ask for help about a subejct on MySQL here?
> >>>>>
> >>>>> thanks,
> >>>>> Flavio Bastos Amiel
> >>>>>
> >>>>>
> >>>>
> >>>>
> >>>
> >>>
> >>>
> >>> --
> >>> PHP General Mailing List (http://www.php.net/)
> >>> To unsubscribe, visit:
> >>> http://www.php.net/unsub.php
> >>
> >>
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php