Re: SQL query for user login
It would not be easier to verify, before the login, that a user already exists in the table. If true then we do nothing, if false, it adds the line.
Re: SQL query for user login
That's what I did. I built a test first with a select.
An alternative as the login, in my environment, is unique was to be a unique identifier on the field with a login error handling behind.
Re: SQL query for user login
If you have developed an application in PHP I strongly suggest you phpDoctrine to define a layer of abstraction on top of your database. This allows for example to avoid such problems or you even create your request.