issue with strcmp - 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: issue with strcmp (
/showthread.php?tid=494611)
issue with strcmp -
oodev - 14.02.2014
hi all,
i have a problem with strcmp, it won't return true, i am surely that name in database is as name in array but when i compare between them it return false!. anyone can help;
Код:
enum bInfo
{
Owner[MAX_PLAYERNAME+1],
bizName[128]
}
new Bizz[2][bInfo];
//mysql statement to get bizznames
new sql_bizname[128];
cache_get_row(0, 3,sql_bizname);
for(new i = 0; i < sizeof(Bizz); i++){
if(strcmp(Bizz[i][bizName], sql_bizname, true) == 0 ){
//do something
}
}
Re: issue with strcmp -
Yashas - 14.02.2014
Post your code with your MySQL statements.
Re: issue with strcmp -
Konstantinos - 14.02.2014
Quote:
Originally Posted by oodev
i am surely that name in database is as name in array but when i compare between them it return false!
|
When the 2 strings are equal, it returns false. You may need to use the max length in the cache_get_row function.
pawn Код:
cache_get_row(0, 3, sql_bizname, connectionHandle, sizeof (sql_bizname)); // Change "connectionHandle" to the variable you store the connection handle.