[Tutorial] Top x players using sqlite
#6

Nice tut!
I even didn't know that this exists XD.
Whatever I have an tip to save diskspace. It's about this part:
pawn Код:
public OnGameModeInit()
{
    top_players = db_open("stats.db");
   
    new query[256];//create a string (I'm not sure if it has to be this big every mysql tutorial I saw had 256 strings
    format(query,sizeof(query),"CREATE TABLE IF NOT EXISTS `Users` (`Name`,`stat`)");//format the string
    db_free_result(db_query(top_players,query));//query the database and free the result
}
You first format the string. That's now not needed, there are no ... idk how it's called but there are not things like this: '%d', '%s', '%i' etc...
So you can just run the query on this way:

pawn Код:
public OnGameModeInit()
{
    top_players = db_open("stats.db");

    db_free_result(db_query(top_players, "CREATE TABLE IF NOT EXISTS `Users` (`Name`,`stat`)"));//query the database and free the result
}
Reply


Messages In This Thread
Top x players using sqlite - by cessil - 24.11.2010, 01:20
Re: Top x players using sqlite - by Jantjuh - 24.11.2010, 05:24
Re: Top x players using sqlite - by Emirt - 24.11.2010, 15:57
Re: Top x players using sqlite - by HyperZ - 24.11.2010, 17:14
Re: Top x players using sqlite - by cessil - 24.11.2010, 23:19
Re: Top x players using sqlite - by Kwarde - 25.11.2010, 04:34
Re: Top x players using sqlite - by Davz*|*Criss - 07.03.2011, 11:10
Re: Top x players using sqlite - by Hal - 07.03.2011, 20:19
Re: Top x players using sqlite - by Mean - 08.03.2011, 17:52
Re: Top x players using sqlite - by Edvin - 21.03.2012, 18:48
Re: Top x players using sqlite - by antonio112 - 22.03.2012, 07:21
Re: Top x players using sqlite - by JaKe Elite - 06.10.2013, 09:43

Forum Jump:


Users browsing this thread: 1 Guest(s)