SA-MP Forums Archive
NULL or not NULL, that is the question - 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: NULL or not NULL, that is the question (/showthread.php?tid=476319)



NULL or not NULL, that is the question - dusk - 17.11.2013

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?


Re: NULL or not NULL, that is the question - SuperViper - 17.11.2013

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


Re: NULL or not NULL, that is the question - dusk - 17.11.2013

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


Re: NULL or not NULL, that is the question - SuperViper - 17.11.2013

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


Re: NULL or not NULL, that is the question - dusk - 18.11.2013

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