SA-MP Forums Archive
[Tutorial] How to use SQLite - 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)
+---- Forum: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] How to use SQLite (/showthread.php?tid=449536)

Pages: 1 2 3


Re: How to use SQLite - Konstantinos - 04.05.2016

I haven't used more than 5 but I don't see any reason why it couldn't handle that number of tables. 'Database Normalization' should be used where possible so it is still better to have many tables than one huge for all the data.


Re: How to use SQLite - SyS - 29.05.2016

pls update this tut with new specifiers new comers are spamming in ma inbox


Re: How to use SQLite - Konstantinos - 29.05.2016

Quote:
Originally Posted by Sreyas
View Post
pls update this tut with new specifiers new comers are spamming in ma inbox
The tutorial has been updated, thank you.


Re: How to use SQLite - Roozevelt - 29.05.2016

Very Useful , thank you kont , but i didn't understand anything , seems too hard for me :/


Re: How to use SQLite - Konstantinos - 29.05.2016

Don't forget that SQL is a second language you need to know. You can read about the basic such as SELECT, INSERT INTO, UPDATE, DELETE etc here: http://www.w3schools.com/sql/
which also has a SQL Editor to run examples or any other website can be found online.

About the script itself, 4 functions are only used (excluding the two to open/close the dabase) and in other occasions, the function to go to the next row which had no use for this tutorial. They're not a lot so it shouldn't confuse you.

Any question you have though, feel free to ask! I'd gladly try to explain it better myself.


Re: How to use SQLite - Roozevelt - 30.05.2016

thank you i'll get it


Re: How to use SQLite - Arbico - 23.10.2017

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.


Re: How to use SQLite - xMoBi - 23.10.2017

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);




Re: How to use SQLite - dani18 - 18.01.2018

Excellent work


Re: How to use SQLite - PlayHard - 05.05.2018

Thank you.


Re: How to use SQLite - xMoBi - 10.08.2018

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.


Re: How to use SQLite - Banditul18 - 10.08.2018

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: https://sampwiki.blast.hk/wiki/Format


Re: How to use SQLite - SapMan - 24.12.2018

Good tutorial, it helped me a lot now that I have a problem. When using an "ip" is "%q" or "%s" used? and when it is a registration date that only contains "12/24/2018", is "%q" or "%s" used? And, is there another method to use instead of "LIMIT 1"? I've seen other scripts and they have this: "SELECT ID FROM PLAYERS WHERE NAME = '%q';" instead of "LIMIT 1" (I mean ";" at the end of "%q". What does that semicolon mean?