SA-MP Forums Archive
SQL - 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: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: SQL (/showthread.php?tid=238885)



SQL - Zh3r0 - 12.03.2011

I couldn't find a proper tutorial or a filterscript that might help me out. Can i please, see a code, that saves 2 things with a value?
Also reading. I would appreciate this a lot!


Re: SQL - Calgon - 12.03.2011

Код:
UPDATE <tableName> SET <fieldName> = '', <fieldName2> = '' WHERE <matchingCriteria> = ''
Example in use:

Код:
UPDATE playerAccounts SET playerName = 'Calg00ne', playerAdminLevel = 2 WHERE playerID = 6
Integers do not need to be wrapped in single quotes, format your query to set the values as necessary, then simply send it out with mysql_query (you *probably* won't need to thread this query).


Re: SQL - Zh3r0 - 12.03.2011

Quote:
Originally Posted by Calg00ne
Посмотреть сообщение
Код:
UPDATE <tableName> SET <fieldName> = '', <fieldName2> = '' WHERE <matchingCriteria> = ''
Example in use:

Код:
UPDATE playerAccounts SET playerName = 'Calg00ne', playerAdminLevel = 2 WHERE playerID = 6
Integers do not need to be wrapped in single quotes, format your query to set the values as necessary, then simply send it out with mysql_query (you *probably* won't need to thread this query).
So this sets admin level 2 on user with id 6 ?

I actually wanted a complete filterscript on how to do it, with everything, db_open, db_query and all these.
New to SQL so this is why ...


Re: SQL - Calgon - 12.03.2011

Search, there's thousands of tutorials on the internet and there's thousands of tutorials explaining usage of the MySQL/SQLite functions.


Re: SQL - Finn - 12.03.2011

Quote:
Originally Posted by Zh3r0
Посмотреть сообщение
So this sets admin level 2 on user with id 6 ?

I actually wanted a complete filterscript on how to do it, with everything, db_open, db_query and all these.
New to SQL so this is why ...
SA-MP wiki to the rescue:

db_open
db_query
db_close


Re: SQL - Zh3r0 - 12.03.2011

Quote:
Originally Posted by Calg00ne
Посмотреть сообщение
Search, there's thousands of tutorials on the internet and there's thousands of tutorials explaining usage of the MySQL/SQLite functions.
Oh, so i can find stuff even on ****** about SQL? Okay then, thanks, i will see what i can learn from there.


Re: SQL - Finn - 12.03.2011

Quote:
Originally Posted by Zh3r0
Посмотреть сообщение
Oh, so i can find stuff even on ****** about SQL? Okay then, thanks, i will see what i can learn from there.
http://www.sqlite.org/
http://www.sqlite.org/lang.html


Re: SQL - Calgon - 12.03.2011

....facepalm


Re: SQL - Zh3r0 - 12.03.2011

Quote:
Originally Posted by Calg00ne
Посмотреть сообщение
....facepalm
Yeah, your sarcasm is always impressive. I never dealt with any databases, so please don't act like a smartass.
Thanks for the help....