Problem with new line on 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problem with new line on mysql (
/showthread.php?tid=269464)
Problem with new line on mysql -
wups - 16.07.2011
Hey, i got this problem:
I have data in a field with \n delimeters.
How can i get them on samp, because mysql_fetch_row doesn't return correctly.
Re: Problem with new line on mysql -
RyDeR` - 16.07.2011
You can try to replace it with something else.
Create a function to replace them with '~' for example (there's one added by me in the Useful functions topic). Then when retrieved use the same function to replace '~' with '\n'. Easy solution if there isn't any other.
Re: Problem with new line on mysql -
wups - 16.07.2011
If tried some str_replace functions on pawn, and none worked good with long strings.
Re: Problem with new line on mysql -
RyDeR` - 16.07.2011
Use replaceChar since they're both just characters from the ASCII table:
pawn Код:
stock replaceChar(strSrc[], chWhat, chWith)
{
for(new i; strSrc[i] != EOS; ++i)
{
if(strSrc[i] == chWhat)
{
strSrc[i] = chWith;
}
}
}
pawn Код:
replaceChar(string, '\n', '~');
EDIT: Works fine for me with very long strings
Re: Problem with new line on mysql -
wups - 16.07.2011
Thanks, it worked