I have followed a previous post on the forum from a different member who was having issues that would could livecode to show incorrect password even though the inputs on the two input field (Username & Password) matched the ones in database. I have gone through the posts and every suggestion I tried it still gives me a false return. Below is the code i'm using and I have adapted it from user 'admin12'. For some reason I cannot post the link to the forum page. Hopefully someone can help me.
Code: Select all
on loginCheck
-- use a global variable to hold the connection ID so other scripts can use it
global gConnectionID
-- set up the connection parameters - edit these to suit your database
put "................." into tDatabaseAddress
put "applogininfo" into tDatabaseName
put "mydatabase" into tDatabaseUser
put "password" into tDatabasePassword
-- connect to the database
put revOpenDatabase("MySQL", tDatabaseAddress, tDatabaseName, tDatabaseUser, tDatabasePassword) into tResult
-- check if it worked and display an error message if it didn't
-- & set the connection ID global
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
put "SELECT Username, Password FROM userpass" and put into theUN
put revDataFromQuery(,,gConnectionID,theUN) into theUNData
if theUNData = the text of field "username" and theUNData = the text of field "password" then
go to card accessed
else
answer "Incorrect username or password. Please try again."
exit to top
end if
end loginCheck
Jamie