Mysql cant get string - 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)
+--- Thread: Mysql cant get string (
/showthread.php?tid=599192)
Mysql cant get string -
Aa12 - 22.01.2016
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?
Re: Mysql cant get string -
jlalt - 22.01.2016
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];....
Re: Mysql cant get string -
Aa12 - 22.01.2016
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
Re: Mysql cant get string -
JeaSon - 22.01.2016
varchar should be 24 size not 128
try this
pawn Код:
cache_get_field_content(i, "Owner", HouseInfo[houseid][hOwner],ConnectionSql, 24);
Re: Mysql cant get string -
jlalt - 22.01.2016
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?
Re: Mysql cant get string -
Aa12 - 22.01.2016
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
Re: Mysql cant get string -
yvoms - 22.01.2016
Nevermind, was posted just after it got fixed.