Need Help - 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: Need Help (
/showthread.php?tid=293085)
Need Help -
dvir174 - 26.10.2011
please I don't know what is the problem here - help me
stock SavePlayerVariable(playerid,set[],value)
{
new SQL[256];
format(SQL,sizeof(SQL),"UPDATE `users` SET '%s' = '%s' WHERE `username` = '%s'",set,value,GetName(playerid));
mysql_query(SQL);
}
Re: Need Help -
park4bmx - 26.10.2011
Quote:
Originally Posted by dvir174
please I don't know what is the problem here - help me
stock SavePlayerVariable(playerid,set[],value)
{
new SQL[256];
format(SQL,sizeof(SQL),"UPDATE `users` SET '%s' = '%s' WHERE `username` = '%s'",set,value,GetName(playerid));
mysql_query(SQL);
}
|
You ahold post he error message but by the looks of it u didn't make the string properly
pawn Код:
stock SavePlayerVariable(playerid,set[256],value)
{
new SQL[256];
format(SQL,sizeof(SQL),"UPDATE `users` SET '%s' = '%s' WHERE `username` = '%s'",set,value,GetName(playerid));
mysql_query(SQL);
}
Re: Need Help -
ikkentim - 26.10.2011
Quote:
Originally Posted by dvir174
please I don't know what is the problem here - help me
stock SavePlayerVariable(playerid,set[],value)
{
new SQL[256];
format(SQL,sizeof(SQL),"UPDATE `users` SET '%s' = '%s' WHERE `username` = '%s'",set,value,GetName(playerid));
mysql_query(SQL);
}
|
If the vakue is a string:
pawn Код:
stock SavePlayerVariable(playerid,set[],value[])
{
new SQL[256];
format(SQL,sizeof(SQL),"UPDATE `users` SET '%s' = '%s' WHERE `username` = '%s'",set,value,GetName(playerid));
mysql_query(SQL);
if the value is an int
pawn Код:
stock SavePlayerVariable(playerid,set[],value)
{
new SQL[256];
format(SQL,sizeof(SQL),"UPDATE `users` SET '%s' = '%d' WHERE `username` = '%s'",set,value,GetName(playerid));
mysql_query(SQL);
Re: Need Help -
dvir174 - 26.10.2011
thank you - I took both of your suggestions also added something of my own and connected them and this is the end result
stock SavePlayerVariable(playerid,set[256],value)
{
new SQL[256];
format(SQL,sizeof(SQL),"UPDATE `users` SET `%s` = '%d' WHERE `username` = '%s'",set,value,GetName(playerid));
mysql_query(SQL);
}