MYSQL Database - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: MYSQL Database (
/showthread.php?tid=356665)
MYSQL Database -
vassilis - 04.07.2012
Nevermind i solve it by myself..
Re: MYSQL Database -
Tee - 04.07.2012
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.
Re: MYSQL Database -
Vince - 04.07.2012
Quote:
Originally Posted by vassilis
I have created a table named User - 3 Rows- Username,Password,Money
|
3
fields. Rows are horizontal, fields (or columns) are vertical.
Re: MYSQL Database -
vassilis - 04.07.2012
Quote:
Originally Posted by Vince
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..
Re: MYSQL Database -
Tee - 05.07.2012
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')
Re: MYSQL Database -
vassilis - 05.07.2012
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
Re: MYSQL Database -
FUNExtreme - 05.07.2012
Why isn't the response for the register dialog in the ondialresponse callback?
Re: MYSQL Database -
vassilis - 05.07.2012
Well i just followed Firecat's tutorial..
EDIT: Could anyone help me i am new to MYSQL
Re: MYSQL Database -
vassilis - 05.07.2012
Guys Any Help ??