Mam problem z pobieraniem nazwy serwera z bazy
Chcę zrobić aby wyszukiwało i pobierało nazwę serwera z bazy i porównywało ją z moją.
Wiem jak zrobić porównanie ale nie mogę zrobić wczytywania, oto moje próby Pomoże ktoś?
public noc_load(id)
{
new serwername[64];
get_cvar_string("hostname", serwername, 63);
g_SqlTupleLicencja = SQL_MakeDbTuple("xxx.pl", "xxx", "xxx", "xxx");
SQL_ThreadQuery(g_SqlTupleNoc, "SelectHandleLicencja", "SELECT server, nazwa FROM `noc` WHERE nazwa='%s'", serwername);
}
public SelectHandleNoc(FailState, Handle:Query, Error[], Errcode, Data[], DataSize)
{
//Check for errors and then process loading from table queries
if ( FailState )
{
if ( FailState == TQUERY_CONNECT_FAILED )
{
log_amx("Load - Could not connect to SQL database. [%d] %s", Errcode, Error);
}
else if ( FailState == TQUERY_QUERY_FAILED )
{
log_amx("Load Query failed. [%d] %s", Errcode, Error);
}
return;
}
if ( !SQL_NumResults(Query) ) // No more results - User not found, create them a blank entry in the table. and zero their variables
{
nazwa = 0;
SQL_ThreadQuery(g_SqlTupleLicencja, "QueryHandle", "INSERT INTO noc VALUES('Server','0')");
return;
}
nazwa = SQL_ReadResult(Query, 0);
}