php-general Digest 27 Jun 2013 21:16:30 -0000 Issue 8280
Topics (messages 321496 through 321514):
Re: Reseting the auto-increment number in a MySQL database.
321496 by: Samuel Lopes Grigolato
321497 by: Stuart Dallas
321498 by: Tedd Sperling
321499 by: Jim Giner
321501 by: Tedd Sperling
321509 by: Matijn Woudt
321510 by: Jim Lucas
321512 by: Tedd Sperling
Last Record INSERT
321500 by: Tedd Sperling
321502 by: Tedd Sperling
321503 by: Stuart Dallas
321504 by: Tedd Sperling
321505 by: Stuart Dallas
321506 by: Samuel Lopes Grigolato
321507 by: Dan Munro
321508 by: Carsten Jensen
321511 by: Tedd Sperling
321513 by: Curtis Maurand
Migration of applications to PHP 5.4
321514 by: Forum
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net
To post to the list, e-mail:
php-gene...@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
You can try this: *ALTER TABLE tbl AUTO_INCREMENT = 100;*
*
*
*Source: *http://dev.mysql.com/doc/refman/5.0/en/example-auto-increment.html
(never did it myself, though)
On Wed, Jun 26, 2013 at 2:07 PM, Tedd Sperling <t...@sperling.com> wrote:
> Hi gang:
>
> I have a client where their next auto-increment number just jumped from
> 2300 to 1000000000 for reasons not understood. They want it set back.
>
> Options such as dropping the primary key and rebuilding the index is NOT
> possible -- this is a relational table thing.
>
> So, is there a way (programmatically) to set the next number in an
> auto-increment?
>
> Something like:
>
> alter table abc auto_increment = 2301;
>
> Any ideas of why this happened?
>
> Cheers,
>
>
> tedd
>
> _____________________
> t...@sperling.com
> http://sperling.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
On Wednesday, 26 June 2013 at 18:07, Tedd Sperling wrote:
> Hi gang:
>
> I have a client where their next auto-increment number just jumped from 2300
> to 1000000000 for reasons not understood. They want it set back.
>
> Options such as dropping the primary key and rebuilding the index is NOT
> possible -- this is a relational table thing.
>
> So, is there a way (programmatically) to set the next number in an
> auto-increment?
>
> Something like:
>
> alter table abc auto_increment = 2301;
>
ALTER TABLE tbl AUTO_INCREMENT = 2301;
-Stuart
--
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
--- End Message ---
--- Begin Message ---
On Jun 26, 2013, at 1:13 PM, Stuart Dallas <stu...@3ft9.com> wrote:
> On Wednesday, 26 June 2013 at 18:07, Tedd Sperling wrote:
>> Hi gang:
>>
>> I have a client where their next auto-increment number just jumped from 2300
>> to 1000000000 for reasons not understood. They want it set back.
>>
>> Options such as dropping the primary key and rebuilding the index is NOT
>> possible -- this is a relational table thing.
>>
>> So, is there a way (programmatically) to set the next number in an
>> auto-increment?
>>
>> Something like:
>>
>> alter table abc auto_increment = 2301;
>>
>
> ALTER TABLE tbl AUTO_INCREMENT = 2301;
>
> -Stuart
Thanks -- I needed confirmation on that.
It is something that i don't want to do.
Cheers,
tedd
_____________________
t...@sperling.com
http://sperling.com
--- End Message ---
--- Begin Message ---
On 6/26/2013 1:30 PM, Tedd Sperling wrote:
On Jun 26, 2013, at 1:13 PM, Stuart Dallas <stu...@3ft9.com> wrote:
On Wednesday, 26 June 2013 at 18:07, Tedd Sperling wrote:
Hi gang:
I have a client where their next auto-increment number just jumped from 2300 to
1000000000 for reasons not understood. They want it set back.
Options such as dropping the primary key and rebuilding the index is NOT
possible -- this is a relational table thing.
So, is there a way (programmatically) to set the next number in an
auto-increment?
Something like:
alter table abc auto_increment = 2301;
ALTER TABLE tbl AUTO_INCREMENT = 2301;
-Stuart
Thanks -- I needed confirmation on that.
It is something that i don't want to do.
Cheers,
tedd
_____________________
t...@sperling.com
http://sperling.com
But more importantly - don't you need to figure out why it happened??
As well as correcting any inserts with the bogus id?
--- End Message ---
--- Begin Message ---
On Jun 26, 2013, at 1:32 PM, Jim Giner <jim.gi...@albanyhandball.com> wrote:
>> But more importantly - don't you need to figure out why it happened?? As
>> well as correcting any inserts with the bogus id?
Yes, I would like to know -- I'm open for suggestions.
Cheers,
tedd
_____________________
tedd.sperl...@gmail.com
http://sperling.com
--- End Message ---
--- Begin Message ---
On Wed, Jun 26, 2013 at 7:35 PM, Tedd Sperling <tedd.sperl...@gmail.com>wrote:
> On Jun 26, 2013, at 1:32 PM, Jim Giner <jim.gi...@albanyhandball.com>
> wrote:
>
> >> But more importantly - don't you need to figure out why it happened??
> As well as correcting any inserts with the bogus id?
>
>
> Yes, I would like to know -- I'm open for suggestions.
>
> Cheers,
>
> tedd
>
> _____________________
> tedd.sperl...@gmail.com
> http://sperling.com
>
>
What storage engine are you using? InnoDB is known for it's auto increment
holes, but I didn't expect the holes to be that big.
- Matijn
--- End Message ---
--- Begin Message ---
On 06/26/2013 10:07 AM, Tedd Sperling wrote:
Hi gang:
I have a client where their next auto-increment number just jumped from 2300 to
1000000000 for reasons not understood. They want it set back.
Options such as dropping the primary key and rebuilding the index is NOT
possible -- this is a relational table thing.
So, is there a way (programmatically) to set the next number in an
auto-increment?
Something like:
alter table abc auto_increment = 2301;
Any ideas of why this happened?
Cheers,
tedd
_____________________
t...@sperling.com
http://sperling.com
If mysql logging is turned on, you might be able to rummage through the
logs and see what happened and when it happened.
--
Jim Lucas
http://www.cmsws.com/
http://www.cmsws.com/examples/
--- End Message ---
--- Begin Message ---
On Jun 26, 2013, at 3:23 PM, Matijn Woudt <tijn...@gmail.com> wrote:
>
> What storage engine are you using? InnoDB is known for it's auto increment
> holes, but I didn't expect the holes to be that big.
I have no idea.
It's not my database. It's Constant Contact's -- I just put stuff in it as per
client's needs.
However, all of a sudden, it's been fixed -- everything is back to "normal" --
very strange.
Thanks to everyone.
Cheers,
tedd
_____________________
tedd.sperl...@gmail.com
http://sperling.com
--- End Message ---
--- Begin Message ---
Hi gang:
What's the most-current way to get the ID of the last recorded inserted in a
database?
Cheers,
tedd
_____________________
t...@sperling.com
http://sperling.com
--- End Message ---
--- Begin Message ---
Gang:
Let me add, currently I am inserting an email address into a database.
To find which record was created, I ask for the record number (ID) back.
I am asking simply because mysql_insert_id() is deprecated.
Cheers,
tedd
_____________________
tedd.sperl...@gmail.com
http://sperling.com
--- End Message ---
--- Begin Message ---
On Wednesday, 26 June 2013 at 18:39, Tedd Sperling wrote:
> Let me add, currently I am inserting an email address into a database.
>
> To find which record was created, I ask for the record number (ID) back.
>
> I am asking simply because mysql_insert_id() is deprecated.
>
How are you doing the insert? If you're inserting with mysql_query() then
that's just as deprecated as mysql_insert_id().
-Stuart
--
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
--- End Message ---
--- Begin Message ---
On Jun 26, 2013, at 1:56 PM, Stuart Dallas <stu...@3ft9.com> wrote:
> On Wednesday, 26 June 2013 at 18:39, Tedd Sperling wrote:
>> Let me add, currently I am inserting an email address into a database.
>>
>> To find which record was created, I ask for the record number (ID) back.
>>
>> I am asking simply because mysql_insert_id() is deprecated.
Now you tell me. :-)
I learn something new every day of my life... and I'm getting damned tried of
it.
Back to the books.
Thanks.
Cheers,
tedd
_____________________
tedd.sperl...@gmail.com
http://sperling.com
--- End Message ---
--- Begin Message ---
On Wednesday, 26 June 2013 at 19:01, Tedd Sperling wrote:
> On Jun 26, 2013, at 1:56 PM, Stuart Dallas <stu...@3ft9.com
> (mailto:stu...@3ft9.com)> wrote:
> > On Wednesday, 26 June 2013 at 18:39, Tedd Sperling wrote:
> > > Let me add, currently I am inserting an email address into a database.
> > >
> > > To find which record was created, I ask for the record number (ID) back.
> > >
> > > I am asking simply because mysql_insert_id() is deprecated.
>
> Now you tell me. :-)
>
The whole mysql module has been deprecated. The recommended module is now
either mysqli or PDO depending on your requirements. Moving to mysqli from
mysql will probably be the less painful route.
-Stuart
--
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
--- End Message ---
--- Begin Message ---
AFAIK "mysql_[...]" is deprecated in favor of "mysqli_[...]" correspondent
functions, there's nothing to do specifically with mysql[i]_insert_id.
On Wed, Jun 26, 2013 at 3:01 PM, Tedd Sperling <tedd.sperl...@gmail.com>wrote:
> On Jun 26, 2013, at 1:56 PM, Stuart Dallas <stu...@3ft9.com> wrote:
> > On Wednesday, 26 June 2013 at 18:39, Tedd Sperling wrote:
> >> Let me add, currently I am inserting an email address into a database.
> >>
> >> To find which record was created, I ask for the record number (ID) back.
> >>
> >> I am asking simply because mysql_insert_id() is deprecated.
>
> Now you tell me. :-)
>
> I learn something new every day of my life... and I'm getting damned tried
> of it.
>
> Back to the books.
>
> Thanks.
>
> Cheers,
>
> tedd
>
> _____________________
> tedd.sperl...@gmail.com
> http://sperling.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
Learning something new everyday is one of the joys of this profession. If
you learn two new things, consider yourself lucky :)
On Wed, Jun 26, 2013 at 11:03 AM, Samuel Lopes Grigolato <
samuel.grigol...@gmail.com> wrote:
> AFAIK "mysql_[...]" is deprecated in favor of "mysqli_[...]" correspondent
> functions, there's nothing to do specifically with mysql[i]_insert_id.
>
>
> On Wed, Jun 26, 2013 at 3:01 PM, Tedd Sperling <tedd.sperl...@gmail.com
> >wrote:
>
> > On Jun 26, 2013, at 1:56 PM, Stuart Dallas <stu...@3ft9.com> wrote:
> > > On Wednesday, 26 June 2013 at 18:39, Tedd Sperling wrote:
> > >> Let me add, currently I am inserting an email address into a database.
> > >>
> > >> To find which record was created, I ask for the record number (ID)
> back.
> > >>
> > >> I am asking simply because mysql_insert_id() is deprecated.
> >
> > Now you tell me. :-)
> >
> > I learn something new every day of my life... and I'm getting damned
> tried
> > of it.
> >
> > Back to the books.
> >
> > Thanks.
> >
> > Cheers,
> >
> > tedd
> >
> > _____________________
> > tedd.sperl...@gmail.com
> > http://sperling.com
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
--
>From the desk of Dan Munro
--- End Message ---
--- Begin Message ---
On 06/26/2013 08:03 PM, Samuel Lopes Grigolato wrote:
> AFAIK "mysql_[...]" is deprecated in favor of "mysqli_[...]" correspondent
> functions, there's nothing to do specifically with mysql[i]_insert_id.
>
>
> On Wed, Jun 26, 2013 at 3:01 PM, Tedd Sperling <tedd.sperl...@gmail.com>wrote:
>
>> On Jun 26, 2013, at 1:56 PM, Stuart Dallas <stu...@3ft9.com> wrote:
>>> On Wednesday, 26 June 2013 at 18:39, Tedd Sperling wrote:
>>>> Let me add, currently I am inserting an email address into a database.
>>>>
>>>> To find which record was created, I ask for the record number (ID) back.
>>>>
>>>> I am asking simply because mysql_insert_id() is deprecated.
>>
>> Now you tell me. :-)
>>
>> I learn something new every day of my life... and I'm getting damned tried
>> of it.
>>
>> Back to the books.
>>
>> Thanks.
>>
>> Cheers,
>>
>> tedd
>>
>> _____________________
>> tedd.sperl...@gmail.com
>> http://sperling.com
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
Tedd take a look at the manual pages for mysqli_insert_id()
this will show how the changes of mysqli compared to mysql are.
(just a little different)
Look at the procedural way of doing it as it's pretty similar to
what you might already be doing. You can of course also jump
to use the object oriented style, but that requires you to
change more of your code if you're replacing mysql with mysqli
http://php.net/manual/en/mysqli.insert-id.php
cheers
Carsten
--- End Message ---
--- Begin Message ---
On Jun 26, 2013, at 2:10 PM, Dan Munro <d...@danmunro.com> wrote:
> Learning something new everyday is one of the joys of this profession. If you
> learn two new things, consider yourself lucky :)
What if it's the same two things?
"New" just means I didn't remember it.
Cheers,
tedd
_____________________
tedd.sperl...@gmail.com
http://sperling.com
--- End Message ---
--- Begin Message ---
Look up using the mysqli libraries. This was about a 30 second php.net
search.
http://us3.php.net/manual/en/mysqli.insert-id.php
Cheers,
Curtis
On 6/26/2013 1:33 PM, Tedd Sperling wrote:
Hi gang:
What's the most-current way to get the ID of the last recorded inserted in a
database?
Cheers,
tedd
_____________________
t...@sperling.com
http://sperling.com
--- End Message ---
--- Begin Message ---
Hello,
i recently migrated my webserver from Debian Lenny (with PHP 4.x) to Wheezy
with PHP 5.4.
Some applications like mediawiki could be updated and they are running fine.
But there are some old and beloved applications that run any more.
A good example is PHPmyedit 5.7.1 http://www.phpmyedit.org/
The first page with data is displayed but all links and buttons are dead!
There is no error produced by PHP and i have no idea why it is not working?
I'm have only basic knowledge with PHP and would be glad to have some tips how
to debug things without error.
My hope is that this migration problem is known and can be fixed simply?
Thanks
Karsten
--- End Message ---