jingzhi Posted November 15, 2015 Share Posted November 15, 2015 Hello, I have a problem with exporting the mySQL connection into the login script, the error is: "failed to call 'mySQL:dbConnection' [string'?']" Here are the codes mySQL.lua local dbType="mysql" local dbName="mta" local dbHost="127.0.0.1" local dbUsername="jingzhi" local dbPassword="" local dbConnection = dbConnect(dbType,"dbname="..dbName..";"..dbHost.."",dbUsername,dbPassword) if dbConnection then outputDebugString("MySQL has been successfuly connected!") else outputDebugString("Failed to connect to MySQL!") end function dbConnection() return dbConnection end meta.xml "JingZhi" type="script" /> login.lua local dbConnection = exports["mySQL"]:dbConnection() Link to comment
jingzhi Posted November 15, 2015 Author Share Posted November 15, 2015 Hello,I have a problem with exporting the mySQL connection into the login script, the error is: "failed to call 'mySQL:dbConnection' [string'?']" Here are the codes mySQL.lua local dbType="mysql" local dbName="mta" local dbHost="127.0.0.1" local dbUsername="jingzhi" local dbPassword="" local dbConnection = dbConnect(dbType,"dbname="..dbName..";"..dbHost.."",dbUsername,dbPassword) if dbConnection then outputDebugString("MySQL has been successfuly connected!") else outputDebugString("Failed to connect to MySQL!") end function dbConnection() return dbConnection end meta.xml "JingZhi" type="script" /> login.lua local dbConnection = exports["mySQL"]:dbConnection() C'mon guys! need help! Link to comment
SpecT Posted November 15, 2015 Share Posted November 15, 2015 You forgot to put host= ... local dbType="mysql" local dbName="mta" local dbHost="127.0.0.1" local dbUsername="jingzhi" local dbPassword="" local dbConnection = dbConnect(dbType,"dbname="..dbName..";host="..dbHost.."",dbUsername,dbPassword) if dbConnection then outputDebugString("MySQL has been successfuly connected!") else outputDebugString("Failed to connect to MySQL!") end function dbConnection() return dbConnection end Link to comment
jingzhi Posted November 15, 2015 Author Share Posted November 15, 2015 You forgot to put host= ... local dbType="mysql" local dbName="mta" local dbHost="127.0.0.1" local dbUsername="jingzhi" local dbPassword="" local dbConnection = dbConnect(dbType,"dbname="..dbName..";host="..dbHost.."",dbUsername,dbPassword) if dbConnection then outputDebugString("MySQL has been successfuly connected!") else outputDebugString("Failed to connect to MySQL!") end function dbConnection() return dbConnection end dbConnect(dbType,"dbname="..dbName..";host="..dbHost.."",dbUsername,dbPassword) I think I put.... Link to comment
jingzhi Posted November 15, 2015 Author Share Posted November 15, 2015 Hello,I have a problem with exporting the mySQL connection into the login script, the error is: "failed to call 'mySQL:dbConnection' [string'?']" Here are the codes mySQL.lua local dbType="mysql" local dbName="mta" local dbHost="127.0.0.1" local dbUsername="jingzhi" local dbPassword="" local dbConnection = dbConnect(dbType,"dbname="..dbName..";"..dbHost.."",dbUsername,dbPassword) Need help! if dbConnection then outputDebugString("MySQL has been successfuly connected!") else outputDebugString("Failed to connect to MySQL!") end function dbConnection() return dbConnection end meta.xml "JingZhi" type="script" /> login.lua local dbConnection = exports["mySQL"]:dbConnection() Link to comment
ALw7sH Posted November 15, 2015 Share Posted November 15, 2015 The script name is mySQL? Also check the debug if there's any errors Link to comment
SpecT Posted November 15, 2015 Share Posted November 15, 2015 Well then update the code you post here (edit button). How could I know you made it right? As alw7sh said post here if there are any errors from debugscript 3. Link to comment
jingzhi Posted November 15, 2015 Author Share Posted November 15, 2015 Well then update the code you post here (edit button). How could I know you made it right?As alw7sh said post here if there are any errors from debugscript 3. Thats all code Link to comment
jingzhi Posted November 15, 2015 Author Share Posted November 15, 2015 The script name is mySQL?Also check the debug if there's any errors Script name is mySQL and no error in debugscript 3 except for the one i showed there Link to comment
ALw7sH Posted November 15, 2015 Share Posted November 15, 2015 Your function name is like your dbConnect varb name change one of them Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now