Using quite string, sscanf, mysql. - 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)
+--- Thread: Using quite string, sscanf, mysql. (
/showthread.php?tid=621762)
Using quite string, sscanf, mysql. -
nGen.SoNNy - 14.11.2016
Hello guys! I want to make something like this:
- I'm using sscanf for getting the string '0:0:0:2:0:0:1:0:0' for example from the database.
- I'm using something like objVar[ 0 ] will be 0, obsVar[ 3 ] will be 2 and so on.
- My question it's how can I update just the value of the fourth number from that string?
(The reason it's that i don't wanna use format for creating a string with 35 values "%d:%d:%d...%d" [35 times]).
Re: Using quite string, sscanf, mysql. -
Vince - 14.11.2016
You shouldn't store more than one atomic value in a single column to begin with. This violates 1NF. If you've got too many values you should instead create another table exclusively for that so that you can have rows instead of columns.
Re: Using quite string, sscanf, mysql. -
nGen.SoNNy - 14.11.2016
Why creating another table?... "0

35 others" = one string in the database
Re: Using quite string, sscanf, mysql. -
nGen.SoNNy - 15.11.2016
BUNP
Re: Using quite string, sscanf, mysql. -
OneDay - 15.11.2016
Table is better because SQL doing the splits for you well and can be JOIN.
Re: Using quite string, sscanf, mysql. -
nGen.SoNNy - 15.11.2016
Nobody understand what i want to do... I just want to change the value of the third number from this string using sscanf: "0:0:2:0:0:1:0:0".