I have got the code below which connects to MySQL database and checks for a username and password. However it works on windows fine but when I use it on an android device I get the error 'Cant connect to TCP/IP socket (13)'. I dont really kinow why its saying this and I have checked the tick box for MySQL in the stand alone application settings. Its only a local database for a college prohjec tim doing so does not need to be too complicated.
Hopefully somebody can help. Below is the code
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 "address" into tDatabaseAddress
put "applogininfo" into tDatabaseName
put "user" into tDatabaseUser
put pass" 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
//SELECTS USER DATA FROM DATABASE AND PUTS THEM INTO VARIABLES 'theUserData & thePassData'
put "SELECT Username FROM userpass" into theUser
put revDataFromQuery(,,gConnectionID,theUser) into theUserData
put "SELECT Password FROM userpass" into thePass
put revDataFromQuery(,,gConnectionID,thePass) into thePassData
//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 accessed
else
answer "Incorrect username or password. Please try again."
exit to top
end if
end loginCheck
Jamie