format function in if statement?
#1

Is it possible to put a format function inside an if statement? I'm trying to do this:
pawn Код:
if(format(query2, sizeof(query2), "SELECT id FROM `gates` WHERE id = '%i'", i));
but the compiler says it's an empty statement
Reply
#2

Oh, right.. I didn't notice I placed the ";". Anyway, I'm going to use brackets to check if the ID already exists.
Reply
#3

ye, you could use strfind or strcmp for this:

https://sampwiki.blast.hk/wiki/Strcmp

https://sampwiki.blast.hk/wiki/Strfind
Reply
#4

Quote:
Originally Posted by ******
Посмотреть сообщение
Neither of those functions will help either! They are quite clearly formatting an SQL query, for which you need either the SQLite or MySQL functions to run.
sorry, my bad, didnt notice the sql part
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)