Problem with SQLite
#1

Okay, so i tried to create a register system with sqlite for a tdm server, but even when I register, the account is not created in the database.

Registration:
pawn Код:
if(strlen(inputtext) <= 3 || strlen(inputtext) > 30) {
             SendClientMessage(playerid, COLOR_MAROON, "Your password cannot be longer than 30 characters or shorter than 4 characters");
             return ShowRegisterDialog(playerid);
          }
          SendClientMessage(playerid, COLOR_RED, "Your account is being registered right now into the database, wait...");
         
          new ip[20];
          GetPlayerIp(playerid, ip, sizeof(ip));

          new hash[129];
          WP_Hash(hash, sizeof(hash), inputtext);

          new query[256];
          format(query, sizeof(query), "INSERT INTO 'Accounts' ('IP', 'Name', 'Password' , 'Admin', 'VIP', 'Kills', 'Deaths', 'Ratio' , 'KillingSpree', 'Money', 'Score', 'Rank') VALUES('%s','%s','%s','%d','%d','%d','%d','%f','%d','%d','%d','%d')", ip, GetUserName(playerid), DB_Escape(hash), 0, 0, 0, 0, 0, 0.0, 0, 0);
          pAccount[playerid][Admin] = 0;
          pAccount[playerid][VIP] = 0;
          pAccount[playerid][Kills] = 0;
          pAccount[playerid][Deaths] = 0;
          pAccount[playerid][Money] = 0;
          pAccount[playerid][Score] = 0;
          pAccount[playerid][Ratio] = 0;
          pAccount[playerid][KillingSpree] = 0;
          pAccount[playerid][Rank] = 0;
          db_query(Account, query);
          db_free_result( db_query(Account, query) );
          SendClientMessage(playerid, COLOR_RED, "Procese completed, your account is now created!");
Database Creation:
pawn Код:
db_free_result(db_query(Account, "CREATE TABLE IF NOT EXISTS 'Accounts' ('IP', 'Name', 'Password' , 'Admin', 'VIP', 'Kills', 'Deaths', 'Ratio' , 'KillingSpree' ,'Money', 'Score', 'Rank')"));
Reply
#2

You need to use backticks for the column names, not singlequotes.

pawn Код:
(`IP`, `Name`, `Password` , `Admin`, ......
Reply
#3

Okay thanks

EDIT: Still don't works...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)