Re: [PHP] Last Record INSERT

2013-06-26 Thread Curtis Maurand


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





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



Re: [PHP] Last Record INSERT

2013-06-26 Thread Tedd Sperling
On Jun 26, 2013, at 2:10 PM, Dan Munro  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






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



Re: [PHP] Last Record INSERT

2013-06-26 Thread Carsten Jensen
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 wrote:
> 
>> On Jun 26, 2013, at 1:56 PM, Stuart Dallas  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

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



Re: [PHP] Last Record INSERT

2013-06-26 Thread Dan Munro
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  >wrote:
>
> > On Jun 26, 2013, at 1:56 PM, Stuart Dallas  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


Re: [PHP] Last Record INSERT

2013-06-26 Thread Samuel Lopes Grigolato
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 wrote:

> On Jun 26, 2013, at 1:56 PM, Stuart Dallas  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
>
>


Re: [PHP] Last Record INSERT

2013-06-26 Thread Stuart Dallas
On Wednesday, 26 June 2013 at 19:01, Tedd Sperling wrote:
> On Jun 26, 2013, at 1:56 PM, Stuart Dallas  (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/




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



Re: [PHP] Last Record INSERT

2013-06-26 Thread Tedd Sperling
On Jun 26, 2013, at 1:56 PM, Stuart Dallas  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



Re: [PHP] Last Record INSERT

2013-06-26 Thread Stuart Dallas
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/




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



Re: [PHP] Last Record INSERT

2013-06-26 Thread Tedd Sperling
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



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