Db get field

From SA-MP Wiki

Jump to: navigation, search

Db get field


Get the content of a field from db_query


Parameters:
(DBResult:dbresult, field, result[], maxlength)
DBResult:dbresultThe result to get the data from
fieldThe field to get the data from
result[]The result
maxlengthThe max length of the field


This function does not return a specific value.


dcmd_myadminlevel
{
        new query[256],string[128],string2[128];
        new DBResult:qresult;
        format(query,sizeof(query),"SELECT Level FROM `users` WHERE Username = '%s'", PlayerName[playerid]);
        qresult = db_query(USERDB,query);
        if(db_num_rows(qresult) == 1)
        {
                db_get_field(qresult,0,string,128);
                format(string2,sizeof(string2),"Your admin level is: %s",string);
                SendClientMessage(playerid,0xAFAFAFAA,string2);
        }
        db_free_result(qresult);
        return 1;
}

Related Functions

The following functions might be useful as well, as they're related to this function in one way or another.

  • db_get_field: Get content of field with specified ID from current result row
Personal tools
In other languages