SA-MP Forums Archive
mysql r33 checking is player in DB - 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 r33 checking is player in DB (/showthread.php?tid=586811)



mysql r33 checking is player in DB - bogushas - 25.08.2015

PHP код:
      mysql_format(dbHandleg_szBuffer120"SELECT * FROM `"MySQL_PLAYERS_TABLE"` WHERE `pName` = '%s'"getPlayerName(playerid));
      new 
rowsfields;
    
cache_get_data(rowsfieldsdbHandle);
      if(
rows)
      {
          
cache_get_field_content(0"pPw"player[playerid][pPw], dbHandle130);
          
loginPlayer(playerid);
      }
      else
      {
          
registerPlayer(playerid);
      } 
I think the code should work good but when I connect with the exsisting account I still get register dialog, not login.


Re: mysql r33 checking is player in DB - CodeStyle175 - 25.08.2015

PHP код:
mysql_format(dbHandle,query,sizeof(query),"SELECT pPw FROM "MySQL_PLAYERS_TABLE" WHERE pName='%e' LIMIT 0,1",
GetPlayerName(playerid));
new 
Cache:cquery=mysql_query(dbHandle,query);
if(
cache_num_rows()){
     
cache_get_field_content(0"pPw"player[playerid][pPw], dbHandle130); 
     
loginPlayer(playerid); 
}else{
     
registerPlayer(playerid);
}
cache_delete(cquery);