need some help with a MySQL Connection
#4

Quote:
Originally Posted by SAWC™
pawn Код:
new playername[MAX_PLAYER_NAME], query[128];
GetPlayerName(playerid, playername, sizeof(playername));
mysql_real_escape(playername, playername); // cleaning player's name
format(query, sizeof(query), "SELECT * FROM `usuarios` WHERE UserName = '%s'", playername); // format query
mysql_query(query); // query
mysql_store_result(); // store results
if(mysql_num_rows() == 1) PlayerInfo[playerid][Registered] = 1; // check results
else PlayerInfo[playerid][Registered] = 0;
mysql_free_result(); // clean memory
That's how you should do it.
Reply


Messages In This Thread
need some help with a MySQL Connection - by TheChaoz - 06.03.2010, 03:27
Re: need some help with a MySQL Connection - by Miguel - 06.03.2010, 04:06
Re: need some help with a MySQL Connection - by TheChaoz - 06.03.2010, 04:20
Re: need some help with a MySQL Connection - by Miguel - 06.03.2010, 04:25
Re: need some help with a MySQL Connection - by TheChaoz - 06.03.2010, 04:26
Re: need some help with a MySQL Connection - by Miguel - 06.03.2010, 04:28
Re: need some help with a MySQL Connection - by TheChaoz - 06.03.2010, 04:34
Re: need some help with a MySQL Connection - by Miguel - 06.03.2010, 04:43
Re: need some help with a MySQL Connection - by TheChaoz - 06.03.2010, 04:57
Re: need some help with a MySQL Connection - by Miguel - 06.03.2010, 05:05

Forum Jump:


Users browsing this thread: 1 Guest(s)