Loading strings from SQL
#1

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

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

I mean like word strings... like a name of a vehicle
Reply
#4

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

split(resultline, car, '|');
Reply
#6

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

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]);
Reply
#8

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

Great, thankyou Carlton.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)