03.09.2016, 13:47
Hey, I've ran into a small problem which I can't figure out why it happens..
I want to fetch all the accounts under a given IP range, and I've scripted the necessary things for it. When I format the query, it leaves the range format (%..%).
1. I used this code:
The inputtext was 127.0. and it printed "127.0." and not %127.0.%
2. I used this code:
The inputtext was 127.0. and it printed "127.0.%" in the console (% = #, in console)
Am I doing something wrong, or isn't that the way to use such query?
I want to fetch all the accounts under a given IP range, and I've scripted the necessary things for it. When I format the query, it leaves the range format (%..%).
1. I used this code:
pawn Код:
format(gQuery, sizeof gQuery, "SELECT `Username`, `IP` FROM `"Users_Table"` WHERE `IP` LIKE '%%s%'", inputtext);
2. I used this code:
pawn Код:
new ip[18];
format(ip, sizeof ip, "%s", inputtext);
format(gQuery, sizeof gQuery, "SELECT `Username`, `IP` FROM `"Users_Table"` WHERE `IP` LIKE %'%s'%", ip);
Am I doing something wrong, or isn't that the way to use such query?