MySQL string saving.
#1

pawn Код:
mysql_fetch_field_row(save, "Faction"); Faction[playerid] = strlen(save);
When I try to display a string it returns just a spacebar. Inside the database VARCHAR(24). Even when I edit in the database: Test, it won't display text. Something at the strlen is wrong. I just want to store a name like: test but it doens't displays correct.
Reply
#2

I couldn't understand much of it, sorry. Could you show more code or try to explain better, what you're trying to do or what's stored in the save string after you use mysql_fetch_field_row?
Reply
#3

The strlen function is for getting the length of the string and returning it, why not simply assign the string passed by the MySQL function straight into the variable you want it in? For example:

pawn Код:
mysql_fetch_field_row(Faction[playerid], "Faction");
Reply
#4

I think he wants the Faction as an integer (or ID for his system). I doubt mysql_fetch_field_row works with variables as the first parameter.

And I'm sorry, I thought I was looking at strval() the whole time, but it appears to be strlen() instead. That would explain it.

// edit no idea why I thought he wants it as an integer value. I assumed it from what I thought was strval I think!
Reply
#5

Quote:
Originally Posted by AndreT
Посмотреть сообщение
I think he wants the Faction as an integer (or ID for his system). I doubt mysql_fetch_field_row works with variables as the first parameter.

And I'm sorry, I thought I was looking at strval() the whole time, but it appears to be strlen() instead. That would explain it.

// edit no idea why I thought he wants it as an integer value. I assumed it from what I thought was strval I think!
You doubt it works with variables as the first parameter? If "save" isn't a variable, what is it? The functions first parameter asks for a string, so it'll work if you give it a string!
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)