Mysql cant get string
#1

code below should get house id and house owner name and print it
Код:
HouseInfo[houseid][ID] = cache_get_field_content_int(i, "HouseID");
HouseInfo[houseid][hOwner]=cache_get_field_content(i, "Owner", HouseInfo[houseid][hOwner]);

new string[200];
format(string, sizeof(string), "House ID : %i ; Owner : %s",
HouseInfo[houseid][ID], HouseInfo[houseid][hOwner]);
print(string);
What I get printed

Код:
[16:33:26] House ID : 42 ; Owner : 
[16:33:26] House ID : 43 ; Owner : 
[16:33:26] House ID : 44 ; Owner : 
Why cant it get owner name? Is something wrong with code or could be something wrong is mysql phpmyadmin?
Reply
#2

PHP код:
HouseInfo[houseid][hOwner]=cache_get_field_content(i"Owner"HouseInfo[houseid][hOwner]); 
change it with:
PHP код:
cache_get_field_content(i"Owner"HouseInfo[houseid][hOwner]); 
and in houseinfo enum be sure you've used hOwner as string for example:
enum hinfo
{
hOwner[MAX_PLAYER_NAME+1],
ID,
};
new HouseInfo[MAX_HOUSES][hinfo];....
Reply
#3

Quote:
Originally Posted by jlalt
Посмотреть сообщение
PHP код:
HouseInfo[houseid][hOwner]=cache_get_field_content(i"Owner"HouseInfo[houseid][hOwner]); 
change it with:
PHP код:
cache_get_field_content(i"Owner"HouseInfo[houseid][hOwner]); 
and in houseinfo enum be sure you've used hOwner as string for example:
enum hinfo
{
hOwner[MAX_PLAYER_NAME+1],
ID,
};
new HouseInfo[MAX_HOUSES][hinfo];....
I did all you said, still doesnt work
Here is picture from phpmyadmin of "Owner", maybe this would help figure out my problem

Reply
#4

varchar should be 24 size not 128

try this
pawn Код:
cache_get_field_content(i, "Owner", HouseInfo[houseid][hOwner],ConnectionSql, 24);
Reply
#5

Quote:
Originally Posted by Aa12
Посмотреть сообщение
I did all you said, still doesnt work
Here is picture from phpmyadmin of "Owner", maybe this would help figure out my problem

can you show me your house enum?
Reply
#6

Quote:
Originally Posted by JeaSon
Посмотреть сообщение
varchar should be 24 size not 128

try this
pawn Код:
cache_get_field_content(i, "Owner", HouseInfo[houseid][hOwner],ConnectionSql, 24);
Thank you, it fixed it
Reply
#7

Nevermind, was posted just after it got fixed.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)