NULL or not NULL, that is the question
#1

pawn Код:
GetRankName(rank,jobid,i);
        printf("Rank:%s",rank);
        if(isnull(rank)) print("Null"),format(str,sizeof(str),"%d:——\n",i);
        else format(str,sizeof(str),"%d:%s\n",i,rank);
Prints:
pawn Код:
[20:49:49] Rank:NULL
[20:49:49] Rank:NULL
[20:49:49] Rank:NULL
[20:49:49] Rank:NULL
The "print("Null")" is NEVER printed, but it is null... Any help?
Reply
#2

isnull doesn't check if the string is equal to null, it checks if the string is empty.
Reply
#3

But the string IS empty. I don't use it anywhere since its' declaration, except a value from MySQL is stored in it(and the value is nothing). So I'm pretty sure it should be empty....
Reply
#4

MySQL may be loading it as null. Formatting it to "" and printing it out to see if it says null.
Reply
#5

Yes, MySQL was loading null, so now if there are no rows(something I should have done at first) I return.
Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)