Vincent Posted December 28, 2013 Posted December 28, 2013 (edited) hello, how can i check if a variable is empty? my code(not all): query_sql "SELECT `last_mac` FROM `login` WHERE `char_id` = " + getcharid(0) + "", .@lastmac; the fild "last_mac" can be empty because of this COLUMN `last_mac` VARCHAR(18) NOT NULL DEFAULT '' But how can i check this with a if? This dont work if (.@lastmac == ) { bla bla } Edited December 28, 2013 by Vincent Quote
Emistry Posted December 28, 2013 Posted December 28, 2013 your script will end up failed... variable is not saved as string login table dont have char_id column it should be like this query_sql( "SELECT `last_mac` FROM `login` WHERE `account_id` = "+getcharid(3), .@lastmac$ ); then to check if the MAC address is empty or not.. if( .@lastmac$[.@i] == "" ){ // mac address is empty } 1 Quote
0 klesler Posted April 19, 2018 Posted April 19, 2018 (edited) So if (!.var) means 'if var is empty' ? If I want it to be true if not empty, should i only use : if (.var) Or should I use if (!(!.var)) ? I was afraid that !.var would only check if .var exists, not validate its value. Edited April 19, 2018 by klesler Quote
Question
Vincent
hello,
how can i check if a variable is empty?
my code(not all):
the fild "last_mac" can be empty because of this
But how can i check this with a if? This dont work
Edited by Vincent4 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.