Giter Site home page Giter Site logo

Comments (3)

therecluse26 avatar therecluse26 commented on July 25, 2024 2

Huh, interesting! I hadn't thought of that method when I wrote it. Thanks
for the tip, I may integrate that in the future :)

On Sat, Sep 24, 2016 at 4:37 PM, Reinier Kors [email protected]
wrote:

Thanks for your response.

I now understand why you added it after digging a bit through the source
code 😄

Although, for my suggestion, you wouldn't even have to add another select
query:

In PDO you can use: PDO::lastInsertId
or for MySQLi you can use mysqli_insert_id();

That's why I said it was unnecessary.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#35 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AH24Ao-7T1spPXhS674lbRTVKk7wWT2Nks5qtYoXgaJpZM4KErji
.

  • bradley david

from php-login.

therecluse26 avatar therecluse26 commented on July 25, 2024

There are a few reasons. Primarily, I chose to go this direction because of
the application logic with sending verification emails to avoid unnecessary
database calls. When the user signs up and gets a valid response back from
the server, it then automatically sends an email to the user for
self-verification which is done using this user id. If we generated the ID
at the database level, we would have to then build an additional select
statement in the middle in order to pull out the new ID for this. Building
the GUID generation step into the PHP code simplifies this. It is
extremely unlikely that you would ever run into a collision, especially
for something like user ids.

If you are still concerned about it, you can either switch the second
option in the uniqid() function to true, which would increase the entropy
of the unique identifier from 13 characters to 23 (there will be a slight
performance impact, but this would be very minimal), or you could add the
functionality on the database end like you said and simply create an
additional select statement within the logic to pull that new ID out to
send for verification. This would create even more processing overhead
though, which is another reason I wouldn't recommend it.

On Fri, Sep 23, 2016 at 3:20 AM, xDiglett [email protected] wrote:

Why are we not auto incrementing the id in the database, but instead,
generating a uniqid.

uniqid does not guarantee uniqueness of return value, and seems
unnecessary in this case.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#35, or mute the thread
https://github.com/notifications/unsubscribe-auth/AH24AjLKhf9bevHZ9bsMgRqhoT5fg1U0ks5qs328gaJpZM4KErji
.

  • bradley david

from php-login.

reinierkors avatar reinierkors commented on July 25, 2024

Thanks for your response.

I now understand why you added it after digging a bit through the source code 😄

Although, for my suggestion, you wouldn't even have to add another select query:

In PDO you can use: PDO::lastInsertId
or for MySQLi you can use mysqli_insert_id();

That's why I said it was unnecessary.

from php-login.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.