FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Is spl_object_hash unique in the SQL sense? Can it be used as a unique SQL db column?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Is spl_object_hash unique in the SQL sense? Can it be used as a unique SQL db column? [message #178388 is a reply to message #178386] Tue, 12 June 2012 19:06 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 6/12/2012 2:47 PM, kurtk(at)pobox(dot)com wrote:
>> No, hashes can never guaranteed to be unique.
>
> I opted to use
>
> md5(uniqid());
>
> to create a unique key.
>

Still not guaranteed to be unique. Hashes never are. But if you've
only got a few thousand items, the chances of a collision are slim.

This is why databases have sequence or auto-increment values.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Best practice, (secure), to save session data?
Next Topic: runkit
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 01:35:30 GMT 2024

Total time taken to generate the page: 0.15802 seconds