Db get field
From SA-MP Wiki
Db get field
Get the content of a field from db_query
(DBResult:dbresult, field, result[], maxlength)
| DBResult:dbresult | The result to get the data from |
| field | The field to get the data from |
| result[] | The result |
| maxlength | The 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_open: Open an SQLite database
- db_close: Close an SQLite database
- db_query: Query an SQLite database
- db_free-result: Free result memory from a query
- db_num_rows: Get number of rows in result
- db_next_row: Move to the next row
- db_num_fields: Get number of fields in result
- db_field_name: Returns the name of a particular field
- db_get_field: Get content of field with specified ID from current result row
- db_get_field_assoc: Get content of field with specified name from current result row
