MySQL Update
#1

Hi I want to upload into mysql database, i'am using StrickenKid MySQL Pluging ...
i've got this error
Код:
[MySQL] Error (0): Failed to exeute query. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE nick = 'Lennox_Foreman' SET level = 1, sati = 0, z_login = 4-3-2012, drzav' at line 1.
and code for update:
Код:
forward SpremiMySQL(playerid);
public SpremiMySQL(playerid)
{
    new y, m, d;
	new h,mi,s;
	getdate(y,m,d);
	gettime(h,mi,s);
	new string1[64];
	new string2[32];
	format(string1, sizeof(string1), "%d-%d-%d", d, m, y);
	format(string2, sizeof(string2), "%d:%d", h, mi);
	new level = PlayerInfo[playerid][pLevel];
	new skin = PlayerInfo[playerid][pChar];
	new godine = PlayerInfo[playerid][pGodine];
	new drzava = PlayerInfo[playerid][pDrzava];
	new sati = PlayerInfo[playerid][pConnectTime];
    new string[512];
	new plname[MAX_PLAYER_NAME];
	GetPlayerName(playerid, plname, sizeof(plname));
 	format(string, sizeof(string), "SELECT * FROM `potpis` WHERE nick = '%s' LIMIT 1", plname);
    mysql_query(string);
    mysql_store_result();
    new rows = mysql_num_rows();
    if(!rows)
    {
        // insert into
        format(string,sizeof(string),"INSERT INTO `potpis` (nick, ime, prezime, level, sati, z_login, drzava, z_login_sati, godine, skin) VALUES ('%s', '%s', '%s', '%d', '%d', '%s','%d','%s','%d','%d')", plname, PrvoIme(playerid), DrugoIme(playerid), level, sati, string1, drzava, string2, godine, skin);
        mysql_query(string);
    }
    if(rows == 1)
    {
		// update
        format(string, sizeof(string), "UPDATE `potpis` SET level = %d, sati = %d, z_login = %s, drzava = %d, godine = %d, skin = %d, z_login_sati = %s  WHERE nick = %s",level, sati, string1, drzava, godine, skin, string2, plname);
        mysql_query(string);
    }
    mysql_free_result();
	return 1;
}
sry for bad englis.. Help someone :S
Reply
#2

BUMPPPPPPPP Help someon pls
Reply
#3

pawn Код:
format(string, sizeof(string), "UPDATE `potpis` SET level = %d, sati = %d, z_login = '%s', drzava = %d, godine = %d, skin = %d, z_login_sati = '%s' WHERE nick = '%s'",level, sati, string1, drzava, godine, skin, string2, plname);
        mysql_query(string);
Reply
#4

man thank you a lot <3
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)