SQLite question
#1

Hello there! so i have started learning SQLite ways, but i got a little question about it,

For example i tried this first to test,

PHP код:
#include <a_samp>
#include <a_sampdb>
#include <zcmd>
main() { }
new 
DBsomeDB// Handle for database. Our queries need to use this so the queries know where to handle things
public OnGameModeInit() {
   
someDB db_open("your.db"); // file 'your.db' will be our SQLite database
}
CMD:getmyname(playeridparams[]) {
    new 
szQuery[74], szOut[32], DBResultqueryszPlayerName[MAX_PLAYER_NAME];
    
GetPlayerName(playeridszPlayerNameMAX_PLAYER_NAME);
    
format(szQuerysizeof(szQuery), "select * from `players` where `playername` = '%s'"szPlayerName);
    
query db_query(someDBszQuery);
    if(
db_num_rows(query) > 0) {
        
SendClientMessage(playerid0"There is more than 0 rows, meaning there is at least 1 row!");
        
SendClientMessage(playerid0"So there is a registered account with my name!");
        
db_get_field_assoc(query"Motto"szOutsizeof(szOut));
        
SendClientMessage(playerid0"Your motto is:");
        
SendClientMessage(playerid0szOut);
        
db_free_result(query);
    }
    return 
1;

it's from a tutorial, i would know how to make a database in scriptfiles, for example like yourdb.dll, it got compiled gratefully but didn't show any file in scriptfiles, does it require player to join the server and use it and to be showen? thanks anyway!
Reply


Messages In This Thread
SQLite question - by RyderX - 19.03.2017, 09:02
Re: SQLite question - by iKarim - 19.03.2017, 09:05
Re: SQLite question - by Konstantinos - 19.03.2017, 09:08
Re: SQLite question - by RyderX - 19.03.2017, 09:10
Re: SQLite question - by Logic_ - 19.03.2017, 09:17
Re: SQLite question - by Hunud - 19.03.2017, 09:18
Re: SQLite question - by RyderX - 19.03.2017, 09:33
Re: SQLite question - by Eoussama - 19.03.2017, 11:25

Forum Jump:


Users browsing this thread: 2 Guest(s)