MYSQL Database
#1

Nevermind i solve it by myself..
Reply
#2

pawn Code:
public OnPlayerConnect(playerid)
{
    new Query[80],pName[24],string[164];
    GetPlayerName(playerid,pName,24);
    format(Query,sizeof(Query),"SELECT `Username` FROM `user2` Where `Username` = '%s' LIMIT 1;",pName);
    mysql_query(Query);
    mysql_store_result();
    if(mysql_num_rows() != 0)//if number of rows is different from 0 then continue
    {
        format(string,sizeof(string),"Hey, %s! \nYour account is registered.\nPlease enter the password to log in!",pName);
        ShowPlayerDialog(playerid,0,DIALOG_STYLE_INPUT,"Log in",string,"Login","");
    }
    else
    {
        format(string,sizeof(string),"Hey, %s! \nYour account is not registered. \nPlease register to continue!",pName);
        ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Register",string,"Register","");
    }
    mysql_free_result();
    return 1;
}
Your problem is in the line where you format the query. You used the grave accent around the %s specfier, they should be single quotes, like this '%s' not `%s`. You can see the difference in the code I posted above.
Reply
#3

Quote:
Originally Posted by vassilis
View Post
I have created a table named User - 3 Rows- Username,Password,Money
3 fields. Rows are horizontal, fields (or columns) are vertical.
Reply
#4

Quote:
Originally Posted by Vince
View Post
3 fields. Rows are horizontal, fields (or columns) are vertical.
My bad sorry i meant to write colums take it as misstypo.

@Tee how does these characters you said affects the script that's what i can't understand.

EDIT: Still just logins anything i write the point is first to register and then login..
Reply
#5

If you use the grave accent it will give the following error "Unknown column 'string' in 'where clause'". And what's the problem you're experiencing?
Where "string" is the string in the WHERE clause (example: Unknown column 'vassilis' in 'where clause')
Reply
#6

The problem is that it doesn't create a new player's row/file or how it is called.
Example when someone joins the server it doesn't asks him to register but to login and you can write any shit on login example :Asdadadsada and you will spawn :S
Reply
#7

Why isn't the response for the register dialog in the ondialresponse callback?
Reply
#8

Well i just followed Firecat's tutorial..
EDIT: Could anyone help me i am new to MYSQL
Reply
#9

Guys Any Help ??
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)