SA-MP Forums Archive
MySQL Plugin (Variables) - 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: MySQL Plugin (Variables) (/showthread.php?tid=386248)



MySQL Plugin (Variables) - NewerthRoleplay - 19.10.2012

How can I use variables within a query? It does not show anywhere how to? for example in most plugins you can use %i for an integer then you can specify the variable that the integer is stored in at the end of the function.
the plugin that I am using for MySQL is here and I am using this plugin as the others are giving me a little bit of issues.

An example of what I mean
pawn Код:
mysql_query("INSERT INTO `houseinfo` (owned) VALUES (%i)", owned, connection);



Re: MySQL Plugin (Variables) - AndreT - 19.10.2012

Format it first using format().

pawn Код:
format(query, sizeof(query), "INSERT INTO `houseinfo` (owned) VALUES (%i)", owned);
mysql_query(query, connection);



Re: MySQL Plugin (Variables) - NewerthRoleplay - 19.10.2012

Quote:
Originally Posted by AndreT
Посмотреть сообщение
Format it first using format().

pawn Код:
format(query, sizeof(query), "INSERT INTO `houseinfo` (owned) VALUES (%i)", owned);
mysql_query(query, connection);
Ahhh thanks man