Raimis_R Posted June 4, 2011 Share Posted June 4, 2011 Hello all again i'm because in wiki it's only 1example with query i asking in this forum how i can check if player exist in mysql db now i'm checking local result = mysql_query(handler,"SELECT `Name` FROM `players` WHERE `Name` = '%s'",getPlayerName(source)) if(mysql_num_rows()) then ouputChatBox("Vartotojas egzistuoja",source) -- Found in the db else outputChatBox("Vartotojas neegzsituoja",source) -- Not found mysql_free_result(result) Problem it's with getPlayerName but i don't know how insert string in query Link to comment
BriGhtx3 Posted June 4, 2011 Share Posted June 4, 2011 local result = mysql_query(handler,"SELECT * FROM players WHERE Name='"..mysql_escape_string( handler, name ).."';") if result then rows = mysql_num_rows(result) if rows == 1 then row = mysql_fetch_row(result) end mysql_free_result(result) end Link to comment
Raimis_R Posted June 4, 2011 Author Share Posted June 4, 2011 Thanks for example i will try do something.. And next how about INSERT INTO ('Name','Password') VALUES ('How Insert String','And where') Sorry but at this moment i can't get how insert strings,because i much time was working on Pawn. BTW I Have experience on mysql just i need more example with strings Link to comment
BriGhtx3 Posted June 4, 2011 Share Posted June 4, 2011 local result = mysql_query(handler, "INSERT INTO player SET Name='"..mysql_escape_string(handler, Name).."', Password='"..md5(password).."';") mysql_free_result(result) I noticed that you worked with pawn, when i saw this ^^ : #define MySQL_HOST "localhost" #define MySQL_USER "root" #define MySQL_PASS "" #define MySQL_DATA "fr" Link to comment
Raimis_R Posted June 4, 2011 Author Share Posted June 4, 2011 Thank you very. #define it's and in C Language and i just was thinking it will be in LUA . ON TOPIC: Thanks! 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