SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Tutorials

Reply
 
Thread Tools Display Modes
Old 30/05/2016, 03:16 PM   #61
Roozevelt
Gangsta
 
Roozevelt's Avatar
 
Join Date: Jan 2016
Location: Tunsia
Posts: 645
Reputation: 154
Default Re: How to use SQLite

thank you i'll get it
__________________
Left SA-MP.
Roosevelt's stunt map pack : Click here
SEF community
Join now

Roozevelt is offline   Reply With Quote
Old 23/10/2017, 09:13 AM   #62
Arbico
Big Clucker
 
Arbico's Avatar
 
Join Date: Jul 2017
Posts: 89
Reputation: 5
Default Re: How to use SQLite

What do i do if i want to print a value that i return from the database
Like i have a database that has someone with score of 50
i want to send a message to that player that he have a score of 50.
__________________
Skype:Arbico
Anywhere, Anytime, i'm here to help.

Arbico is offline   Reply With Quote
Old 23/10/2017, 09:51 AM   #63
xMoBi
Banned
 
Join Date: Jul 2017
Location: Islamic Republic of Pakistan
Posts: 111
Reputation: 26
Default Re: How to use SQLite

PHP Code:
new DBResult:result db_query(sql_pipeline"SELECT * FROM `table_name` WHERE `score` = 50 LIMIT 1");
if(
db_num_rows(result)) {
    new 
name[MAX_PLAYER_NAME], string[100];
    
db_get_field_assoc_int(0"name"namesizeof name);
    
format(stringsizeof(string), "%s has 50 score"name);
    
SendClientMessage(playerid, -1string);

xMoBi is offline   Reply With Quote
Old 18/01/2018, 09:00 PM   #64
dani18
Big Clucker
 
dani18's Avatar
 
Join Date: Dec 2017
Posts: 115
Reputation: 14
Default Re: How to use SQLite

Excellent work
__________________
RIP X
dani18 is offline   Reply With Quote
Old 05/05/2018, 04:38 AM   #65
PlayHard
Huge Clucker
 
PlayHard's Avatar
 
Join Date: Nov 2011
Location: In an apartment
Posts: 218
Reputation: 22
Default Re: How to use SQLite

Thank you.
PlayHard is offline   Reply With Quote
Old 10/08/2018, 09:54 AM   #66
DAKYSKYE
Little Clucker
 
DAKYSKYE's Avatar
 
Join Date: Jul 2018
Location: Rustavi, Georgia.
Posts: 30
Reputation: 0
Default Re: How to use SQLite

Quote:
Originally Posted by Konstantinos View Post
You should. I will give you an example of what SQL Injection is.

Let's say your mode has a dialog (input) and someone insert a "name" to check something for a user. He can input:
pawn Code:
"Zeus';DROP TABLE users;"
And it will just delete your table "users". DB_Escape is used for this reason. To prevent someone from doing something bad to your database. You can also read more about DB_Escape/SQL Injection to the wiki (http://wiki.sa-mp.com/wiki/Escaping_Strings_SQLite) or wikipedia (http://en.wikipedia.org/wiki/SQL_injection)

You just need to check any string you insert in a query with:
pawn Code:
// An example:
"SELECT username FROM users WHERE ip = '%s'", DB_Escape( ip ) // etc..

Glad to hear that you use SQLite, it's great and I can confirm it because I know that a very popular server in the past used SQLite and had over 500,000 registered users and everything worked fine!

Thanks for your kind words.
Thanks, I have just learnt about what DB_Escape does.
__________________
Add me on Discord - !DAKYSKYE#4590
DAKYSKYE is offline   Reply With Quote
Old 10/08/2018, 09:59 AM   #67
xMoBi
Banned
 
Join Date: Jul 2017
Location: Islamic Republic of Pakistan
Posts: 111
Reputation: 26
Default Re: How to use SQLite

Quote:
Originally Posted by DAKYSKYE View Post
Thanks, I have just learnt about what DB_Escape does.
DB_Escape is obsolete, use %e specifier instead.
xMoBi is offline   Reply With Quote
Old 10/08/2018, 10:10 AM   #68
Banditul18
Huge Clucker
 
Join Date: Nov 2014
Location: Brasov,Romania
Posts: 342
Reputation: 32
Default Re: How to use SQLite

Quote:
Originally Posted by xMoBi View Post
DB_Escape is obsolete, use %e specifier instead.
We are talking about SQLite not MySQL so the specifier its %q not %e acording to the wiki: http://wiki.sa-mp.com/wiki/Format
__________________
Banditul18 is online now   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SQLite help CreativityLacker Scripting Help 2 12/05/2013 11:37 AM
SQLITE help Ryan_Obeles Scripting Help 9 28/04/2013 02:55 AM
Little help on sqlite FireCat Help Archive 4 20/08/2011 02:45 PM


All times are GMT. The time now is 05:28 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.