MySQL select from >> variable lazarus / 16-Databases ---------------------------------------------------------------------- TheOddOne · 2014-11-29 17:07 Hi there, I've connected successfully to my online database. When selecting data via the SQLQuery, how would I assign a variable to what was found? See I have a userdetails table on the database with obviously a username and password column for a log in interface. How could you assign a variable to what was found if found <> to nill. So obviously is selected data is = to the output then login = true Code: [Select]INPUT UsernameInput; INPUT PasswordInput; LogInSuccessful := False; MySQL.Execute; "SELECT Username, Password FROM UserDetails" IF (UsernameInput = SQLUsername) AND (PasswordInput = SQLPassword) THEN LogInSuccessful := True; Has that made any sense? ---------------------------------------------------------------------- Leledumbo · 2014-11-29 18:46 Better pass the username and password input to the query (I suggest hashing the password for security). Code: [Select]select * from userdetails where username=:username and password=sha1(:password)will do the job. you can then simply check, after calling SQLQuery.Open, whether SQLQuery.EOF is true (login successful) or not (failed) since the query will return empty rows if the no matching values found. ---------------------------------------------------------------------- TheOddOne · 2014-11-30 18:58 Thanks for that. I've got it working now and onto my entire project <3.