14.03.2010, 16:41
2 things,
first: Is it possible that mysql_connect returns inversely?
when using this
It always returns MySQL has failed to connect., and then I go on to run querys in the rest of the script.
Second:
When using this addapted from menax's code
the server always crashes, and the mysql log from the insert is (Error (0): Could not execute query. Unknown column 'iownafiretruck' in 'where clause'.) (iownafiretruck is the username), Im having a decent amount of trouble using the insert query with this plugin. Can anyone help?
first: Is it possible that mysql_connect returns inversely?
when using this
Код:
if(mysql_connect(SQL_HOST,SQL_USER,SQL_PASS,SQL_DB)) { print("MySQL connected."); print("Registration System Loaded."); } else { print("MySQL has failed to connect."); }
Second:
When using this addapted from menax's code
Код:
ZCMD:register(playerid,params[]) { new tmp[256], idx; tmp = strtok(params, idx); new string[256]; if(Logged[playerid]) { return SendClientMessage(playerid,COLOR_GREY,"You are already registered and logged in."); } if(IsRegistered(playerid)) { return SendClientMessage(playerid,COLOR_GREY,"You're already registered."); } if(isnull(tmp)) { return SendClientMessage(playerid,COLOR_GREY,"Usage: /register [password]"); } mysql_escape_string(params,params); mysql_escape_string(pInfo[playerid][name],pInfo[playerid][name]); format(string,sizeof(string),"INSERT INTO players (Name,Password,kills,score,deaths,banned,cash,bank,level) VALUES ('%s','%s',0,0,0,0,0,0,0)",pInfo[playerid][name],params); query(string); SendClientMessage(playerid,COLOR_GREY,"Registered, user now use /login [password]"); return 1; }