Problem with new line on mysql
#1

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.
Reply
#2

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.
Reply
#3

If tried some str_replace functions on pawn, and none worked good with long strings.
Reply
#4

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

Thanks, it worked
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)