Mysql creating accounts problem
#1

I used this tutorial(https://sampforum.blast.hk/showthread.php?tid=574714) so to convert my script to mysql however,I got a problem that i can register only one account with the ID 0 and when I try to register with another accounts it lets me register and login but the account is created in the database.

This on responding to register dialog
Code:
GetPlayerName(playerid, playername, sizeof(playername));
GetPlayerIp(playerid, playerip, sizeof(playerip));
WP_Hash(Player[playerid][Password], 129, inputtext);
mysql_format(koneksi, query, sizeof(query), "INSERT INTO `users` (`Name`, `Password`, `IP`, `Bankcash`, `Money`) VALUES ('%e', '%e', '%e' ,50000, 30000)", playername, Player[playerid][Password], playerip);
mysql_tquery(koneksi, query, "OnAccountRegister", "i", playerid);
and this is my OnAccountRegister
Code:
forward OnAccountRegister(playerid);
public OnAccountRegister(playerid)
{
    Player[playerid][pIDs] = cache_insert_id();
    printf("[Registration] New account registered. Database ID: [%d]", Player[playerid][pIDs]);
    return true;
}
Reply
#2

http://i19.servimg.com/u/f19/19/20/5...h/xampp-21.png
Notice the index set to 'PRIMARY' and the A_I option checked.
Basically we will use the ID column to identify the player in the database and for every new record, the ID goes up by one. For example: I made the first account on your server, my database ID is now 1. You make your account after I do, you ID will be 2.



did you do this step ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)