04.05.2011, 10:10
(
Последний раз редактировалось iggy1; 04.05.2011 в 12:06.
Причина: confused rows for columns
)
I have only just started using Mysql in my code i have a small IsPlayerRegistered function and i use "SELECT *" just to see if any columns are returned (thanks ****** ). Is that much more inefficient than just selecting one column? I know i could use either, but i would still like to know which is best to use in this situation.
Thanks for your time.
pawn Код:
stock IsPlayerRegistered(playerid)
{
new
query[DEFAULT_QUERY_SIZE], eName[MAX_PLAYER_NAME];
mysql_real_escape_string(gPlayerData[playerid][e_zPlayerName], eName);
format(query, sizeof(query), "SELECT * FROM `users` WHERE `username` = '%s'", gPlayerData[playerid][e_zPlayerName]);//should i select all or one row here?
mysql_query(query);
mysql_store_result();
if(mysql_num_rows() != 0)
{
mysql_free_result();
return 1;
}
else
{
mysql_free_result();
return 0;
}
}