Server Problem (MySQL)
#2

your insert looks ok, does it work for new players?

your update needs to know where, i usually use id field but can do with name i suppose. here...



Код:
    new query[130 + MAX_PLAYER_NAME]; 
    format(query, sizeof(query), "SELECT * FROM aliases WHERE username = '%s'", PlayerName(playerid)); 
    new result = mysql_query(query); 
    if(mysql_num_rows(result) == 0) 
    { 
        new aquery[130 + MAX_PLAYER_NAME]; 
        format(aquery, sizeof(aquery), "INSERT INTO aliases (id, username, ip) VALUES ('0', '%s', '%s')", PlayerName(playerid), PlayerIP(playerid)); 
        mysql_query(aquery); 
    } else { 
        new aquery[130 + MAX_PLAYER_NAME]; 
        format(aquery, sizeof(aquery), "UPDATE aliases SET username = '%s', ip = '%s' WHERE username = '%s'", PlayerName(playerid), PlayerIP(playerid), PlayerName(playerid)); 
        mysql_query(aquery); 
    }
Reply


Messages In This Thread
Server Problem (MySQL) - by Unstoppable - 29.09.2012, 13:24
Re: Server Problem (MySQL) - by Necro[ABK] - 29.09.2012, 14:01
Re: Server Problem (MySQL) - by Unstoppable - 29.09.2012, 14:05
Re: Server Problem (MySQL) - by Necro[ABK] - 29.09.2012, 14:10
Re: Server Problem (MySQL) - by Vince - 29.09.2012, 14:35
Re: Server Problem (MySQL) - by Unstoppable - 29.09.2012, 14:58

Forum Jump:


Users browsing this thread: 1 Guest(s)