I have an SQL code that checks against two field which are Username and Password. It then checks to see if the records exists and allow somebody to log in if they do. However, it will only work when I have 1 record in the database and when I add another record, it will then take every record and only the first record work. Is there a way to get around this and for it to search through the column without it taking the first record.
Here is the code on the card:
Code: Select all
if tResult is a number then
put tResult into gConnectionID
else
put empty into gConnectionID
answer error "Unable to connect to the database:" & cr & tResult
end if
//SELECTS USER DATA FROM DATABASE AND PUTS THEM INTO VARIABLES 'theUserData & thePassData'
put "SELECT Username FROM Logininfo" into theUser
put revDataFromQuery(,,gConnectionID,theUser) into theUserData
put "SELECT Password FROM Logininfo" into thePass
put revDataFromQuery(,,gConnectionID,thePass) into thePassData
answer theUserData
//CHECKS TO SEE IF THE INPUTS MATCH THE DATABASE RECORDS
if theUserData = the text of field "username" and thePassData = the text of field "password" then
go to card LoadingScreen
else
answer "Incorrect username or password. Please try again."
global gConnectionID
-- if we have a connection, close it and clear the global connection ID
if gConnectionID is a number then
revCloseDatabase gConnectionID
put empty into gConnectionID
end if
exit to top
end if
end loginCheck
Jamie