FSXTim Posted June 27, 2012 Share Posted June 27, 2012 Hello, I have a small problem. The DebugString sais 'Error!' (line 4), but why? function MySQL_GetString(tableN, feldN, bedingung) local result = mysql_query(sqlcon, "SELECT "..tableN.." from "..feldN.." WHERE "..bedingung) if (not result) then outputDebugString("Error!") else if(mysql_num_rows(result) > 0) then local ds = mysql_fetch_assoc(result) local savename = feldname mysql_free_result(result) return ds[feldname] else mysql_free_result(result) return false end end end Greets Link to comment
qaisjp Posted June 27, 2012 Share Posted June 27, 2012 (edited) There is something wrong with your query. Edited June 10, 2020 by qaisjp Remove "cos ur gay" at start of post Link to comment
FSXTim Posted June 27, 2012 Author Share Posted June 27, 2012 Thanks for your answer. Here i definied sqlcon: host = "XX" user = "XX" pass = "XX" db = "XX" port = 3306 sqlcon = mysql_connect(host, user, pass, db, port) Just for example, here is a script, which is working perfectly with the mysql_query and sqlcon: function playerLogin ( username,password,email ) local result = mysql_query(sqlcon,"SELECT * FROM user_data WHERE Username='"..mysql_escape_string( sqlcon, username ).."';") if result then rows = mysql_num_rows(result) if rows == 1 then row = mysql_fetch_row(result) end mysql_free_result(result) end end Greets Link to comment
qaisjp Posted June 27, 2012 Share Posted June 27, 2012 I don't know mysql, use the DB functions if ur not a pro. 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