SA-MP Forums Archive
What is wrong in here? - 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: What is wrong in here? (/showthread.php?tid=304371)



What is wrong in here? - T0pAz - 18.12.2011

What is wrong in the code?

pawn Код:
new IP[2][16];

mysql_fetch_field_row(IP[0], "ip");
printf("IP[0] is %s and IP[1] is %s", IP[0], IP[1]);
if(!strcmp(IP[0], IP[1]))
{
    printf("STRCOMPARED between IP[0] is %s and IP[1] is %s", IP[0], IP[1]);
}
OK let me explain. First of all when the first printf has been called, the IP[0] is nothing and the IP[1] is my ip address. There is already an ip column on mysql database. So why is that? Secondly and most weirdly, it's printing out STRCOMPARED . How on earth? How did it compared between a string which is nothing with my ip address? I think I have made mistake somewhere.


Re: What is wrong in here? - [HiC]TheKiller - 18.12.2011

pawn Код:
mysql_debug(1);
at the top of your script. Then post the mysql log file in your server directory.


Re: What is wrong in here? - T0pAz - 18.12.2011

pawn Код:
CMySQLHandler::FetchField(ip) - You cannot call this function now. (Reason: Fields/Rows are empty.)
But how does the string comparing if it's nothing?


Re: What is wrong in here? - [HiC]TheKiller - 18.12.2011

Quote:
Originally Posted by T0pAz
Посмотреть сообщение
pawn Код:
CMySQLHandler::FetchField(ip) - You cannot call this function now. (Reason: Fields/Rows are empty.)
But how does the string comparing if it's nothing?
If you use null (nothing) in strcmp, it will always return that the strings match.


Re: What is wrong in here? - T0pAz - 18.12.2011

Quote:
Originally Posted by [HiC]TheKiller
Посмотреть сообщение
If you use null (nothing) in strcmp, it will always return that the strings match.
aaaah that's why. I will try to figure it out. Thanks mate.