What is wrong in here?
#1

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.
Reply
#2

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

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?
Reply
#4

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.
Reply
#5

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.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)