[Tutorial] How to use SQLite
#41

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.
Reply
#42

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

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.
Reply
#44

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

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.
Reply
#46

thank you i'll get it
Reply
#47

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.
Reply
#48

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

Reply
#49

Excellent work
Reply
#50

Thank you.
Reply
#51

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.
Reply
#52

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
Reply
#53

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?
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)