SA-MP Forums Archive
Loading strings from 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: Loading strings from SQL (/showthread.php?tid=155798)



Loading strings from SQL - Antonio [G-RP] - 19.06.2010

I know how to load floats (floatstr) and variables (strval), but how do I load strings? (ex. Hello there, Sanchez, Sultan)


Re: Loading strings from SQL - dice7 - 19.06.2010

When you get the 'integers' and 'floats' from your database they are strings already


Re: Loading strings from SQL - Antonio [G-RP] - 19.06.2010

I mean like word strings... like a name of a vehicle


Re: Loading strings from SQL - WackoX - 19.06.2010

First of all, show you ''explode'' or ''split'' function you use with that code.


Re: Loading strings from SQL - Antonio [G-RP] - 19.06.2010

split(resultline, car, '|');


Re: Loading strings from SQL - WackoX - 20.06.2010

Quote:
Originally Posted by ♂ Antonio [G-RP
]
split(resultline, car, '|');
Okay, that's not the way the most of us use it, can you show me the whole code? (not split but the code around it)


Re: Loading strings from SQL - Carlton - 20.06.2010

Use format.

pawn Код:
format(YourString, 128, resultsplit[blahblah]);
YourString - String that's getting compiled from the result.
128 - The maximum size.
resultsplit[First dimension] - The two dimension array that you would use for integers and floats. ( strval(resultsplit[dfskdksjf]);

Here's an example of one of my MySQL loadings..

pawn Код:
format(FactionData[fid][fMOTD], 128, fsplit[3]);
FactionData[fid][fAreaColor] = strval(fsplit[4]);



Re: Loading strings from SQL - Sergei - 20.06.2010

You can use strmid, but I suggest you to look for other methods of retrieving data from MySQL which are much easier.


Re: Loading strings from SQL - Antonio [G-RP] - 21.06.2010

Great, thankyou Carlton.