SA-MP Forums Archive
Whats wrong with this (SQL)? - 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: Whats wrong with this (SQL)? (/showthread.php?tid=336051)



Whats wrong with this (SQL)? - nescha - 20.04.2012

Hey guys,
i have a little problem with my SQL-Script.

When a user login, the DB should read the string from the line. It was stored properly, but it will not read correctly from the DB. For example: I'm married to "QueenHard", it it is read out as "ueen Hard". I also see sometimes special characters / after the name (ingame).

Код:
mysql_fetch_field("MarriedTo",exstring);
PlayerInfo[playerid][pMarriedTo] = strmid(PlayerInfo[playerid][pMarriedTo], exstring, 0, strlen(exstring)-1, 255);
I used strickenkids mysql-plugin.

Is this the wrong reading / get method from the DB?

Anyone have a idea?

Thanks for help!

Greetz


Re: Whats wrong with this (SQL)? - Ainseri - 20.04.2012

Why are you using strmid? Are you trying to extract something from the value you retrieved? If not, use sscanf. Also, are you substracting one from strlen because you think it'll include the nullifier in the string? Strlen won't do that; sizeof will.


Re: Whats wrong with this (SQL)? - coole210 - 20.04.2012

Did you check the mysql log file for any errors?


AW: Whats wrong with this (SQL)? - nescha - 25.04.2012

Hey,

the MySQL Log is clean.

This are the two load-parts (when a user connects, that stuff will be loaded from the mysql-database).

I wan't to put the string into the PlayerInfo[playerid][pMarriedTo] var. But it dont put all in it. When i'm "MarriedTo" "Nescha_Love", it will be shown like "escha_lov" (or something like this, in the database it looks correctly, but not ingame).


Sorry for my bad english.

Hope for more help and thanks for your replies. :S


Re: Whats wrong with this (SQL)? - wups - 25.04.2012

pawn Код:
mysql_fetch_field("MarriedTo",PlayerInfo[playerid][pMarriedTo]);
And if you really want to copy the string:
pawn Код:
#define strcpy(%0,%1,%2)  \  // destination,source,lenght
    strcat((%0[0] = '\0', %0), %1, %2)



Re: Whats wrong with this (SQL)? - xxmitsu - 25.04.2012

What if:
pawn Код:
mysql_fetch_field("MarriedTo",PlayerInfo[playerid][pMarriedTo]);
?

LE: sorry wups, we posted in the same time.