SQL databse - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SQL databse (
/showthread.php?tid=331308)
SQL databse -
spd_sahil - 04.04.2012
i have an SQL databse , which is created in my gamemode..
but i want to access the values from inside it in another filterscript.. how do i achieve this ?
Re: SQL databse -
Roel - 04.04.2012
You mean you want to connect to the database within a filterscript?
Re: SQL databse -
spd_sahil - 04.04.2012
yes exactly
Re: SQL databse -
Roel - 04.04.2012
Well just copy the part in your gamemode that connects to the database, mostly this will be in OnGameModeinit.
And you have to include the mysql.inc in your filterscript, also you can copy this from your gamemode.
Re: SQL databse -
aRoach - 04.04.2012
Use:
pawn Код:
db_open( name[ ] ); // At OnFilterScriptInit
db_close( DB:Database ); // At OnFilterScriptExit
And do your job
![Smiley](images/smilies/smile.png)
)
-----------
Quote:
Originally Posted by Roel
Well just copy the part in your gamemode that connects to the database, mostly this will be in OnGameModeinit.
And you have to include the mysql.inc in your filterscript, also you can copy this from your gamemode.
|
Lol man, it's not MYSQL, it's SQLite lol...
Re: SQL databse -
Roel - 04.04.2012
congratz
Re: SQL databse -
spd_sahil - 04.04.2012
Quote:
Originally Posted by aRoach
Use:
pawn Код:
db_open( name[ ] ); // At OnFilterScriptInit db_close( DB:Database ); // At OnFilterScriptExit
And do your job ![Smiley](images/smilies/smile.png) )
|
are u sure that works ? my server crashes when i reach the function where the FS is extracting from the database
also is this a legit query ??
pawn Код:
format(Query, sizeof(Query), "SELECT * FROM `USERS` WHERE `NAME` = '%s' ", DB_Escape(name));
Re: SQL databse -
spd_sahil - 05.04.2012
bump