15.02.2018, 13:53
Hello all,
I am learning SQL Lite and i have a few questions.
The first question is, do i have to free the result after a script or after each query?
Which one would be the right thing to do? option 1 or 2?:
option 1:
option 2:
My next question is about DB_Escape()... I am aware of the fact that this should prevent SQL injection? But how does a sql injection work? I know what they can do with it, but how do they do it? and how does DB_Escape prevent this?
Thanks in advance.
Edit:
I have another question, if i want to create a UCP, is there a way to put the .db file on my webserver?
with ../ perhaps? Or maybe by putting the samp server in the www folder? both servers are hosted on the same system. How could i do this? would it work with .../ or putting it in www folder?
I am learning SQL Lite and i have a few questions.
The first question is, do i have to free the result after a script or after each query?
Which one would be the right thing to do? option 1 or 2?:
option 1:
PHP код:
format(szQuery, sizeof(szQuery), "select * from `PINCODES` where `PlayerName` = '%s'", GetName(playerid));
SPAWN_RESULT = db_query(PIN_DATABASE, szQuery);
db_get_field_assoc(SPAWN_RESULT, "CurrentImput", SpawnConnectDBstr3, sizeof(SpawnConnectDBstr3));
//code here
format(szQuery2, sizeof(szQuery2), "update `PINCODES` set `CurrentImput` = `%s` where `playername` = '%s'", DB_Escape(Input), GetName(playerid));
db_free_result(SPAWN_RESULT);
db_free_result(db_query(PIN_DATABASE, szQuery2));
PHP код:
format(szQuery, sizeof(szQuery), "select * from `PINCODES` where `PlayerName` = '%s'", GetName(playerid));
SPAWN_RESULT = db_query(PIN_DATABASE, szQuery);
db_get_field_assoc(SPAWN_RESULT, "CurrentImput", SpawnConnectDBstr3, sizeof(SpawnConnectDBstr3));
db_free_result(SPAWN_RESULT);
//code here
format(szQuery2, sizeof(szQuery2), "update `PINCODES` set `CurrentImput` = `%s` where `playername` = '%s'", DB_Escape(Input), GetName(playerid));
db_free_result(db_query(PIN_DATABASE, szQuery2));
Thanks in advance.
Edit:
I have another question, if i want to create a UCP, is there a way to put the .db file on my webserver?
with ../ perhaps? Or maybe by putting the samp server in the www folder? both servers are hosted on the same system. How could i do this? would it work with .../ or putting it in www folder?