MySQL errors in log.
#1

I have this errors in server log.
Код HTML:
[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 'NULL' at line 1.
[MySQL] Error (0): Function: mysql_store_result called when no prior successful query executed. 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 'NULL' at line 1.
[MySQL] Error (0): Function: mysql_num_rows called when no result stored. 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 'NULL' at line 1.
For example my structures.MySQL by Strickenkid

Код HTML:
stock AddFriend(playerid, friend[]) {
	new query[256];
	format(query, sizeof(query), "INSERT INTO `Znajomi` (`Nick`, `Znajomy`, `Akceptowane`) VALUES('%s', '%s', 0)", GetPlayerNick(playerid), friend);
	mysql_query(query);
}

stock RemoveFriend(playerid, friend[]) {
    new query[256];
    format(query, sizeof(query), "DELETE FROM `Znajomi` WHERE (`Nick` = '%s' AND `Znajomy` = '%s') OR (`Znajomy` = '%s' AND `Nick` = '%s')", GetPlayerNick(playerid), friend, GetPlayerNick(playerid), friend);
    mysql_query(query);
}

stock IsInvitedFriend(playerid, friend[]) {
	new query[256];
	new bool:isfriend = false;
	format(query, sizeof(query), "SELECT * FROM `Znajomi` WHERE (`Nick` = '%s' AND `Znajomy` = '%s' AND `Akceptowane` = 0) OR (`Nick` = '%s' AND `Znajomy` = '%s' AND `Akceptowane` = 0)",
	GetPlayerNick(playerid), friend, friend, GetPlayerNick(playerid));
    mysql_query(query);
    mysql_store_result();
    isfriend = mysql_num_rows()>0;
    mysql_free_result();
    return isfriend;
}

stock IsAcceptedFriend(playerid, friend[]) {
    new query[256];
    new bool:isfriend = false;
    format(query, sizeof(query), "SELECT * FROM `Znajomi` WHERE (`Nick` = '%s' AND `Znajomy` = '%s' AND `Akceptowane` = 1) OR (`Nick` = '%s' AND `Znajomy` = '%s' AND `Akceptowane` = 1) ",
    GetPlayerNick(playerid), friend, friend, GetPlayerNick(playerid));
    mysql_query(query);
    mysql_store_result();
    isfriend = mysql_num_rows()>0;
    mysql_free_result();
    return isfriend;
}

stock AcceptFriend(playerid, friend[]) {
	new query[256];
	format(query, sizeof(query), "UPDATE `Znajomi` SET `Akceptowane` = 1 WHERE (`Nick` = '%s' AND `Znajomy` = '%s') OR (`Nick` = '%s' AND `Znajomy` = '%s')",
	GetPlayerNick(playerid), friend, friend, GetPlayerNick(playerid));
	mysql_query(query);
}
Reply
#2

You must put ' at 0 and 1!
pawn Код:
stock AddFriend(playerid, friend[]) {
    new query[256];
    format(query, sizeof(query), "INSERT INTO `Znajomi` (`Nick`, `Znajomy`, `Akceptowane`) VALUES('%s', '%s', '0')", GetPlayerNick(playerid), friend);
    mysql_query(query);
}

stock RemoveFriend(playerid, friend[]) {
    new query[256];
    format(query, sizeof(query), "DELETE FROM `Znajomi` WHERE (`Nick` = '%s' AND `Znajomy` = '%s') OR (`Znajomy` = '%s' AND `Nick` = '%s')", GetPlayerNick(playerid), friend, GetPlayerNick(playerid), friend);
    mysql_query(query);
}

stock IsInvitedFriend(playerid, friend[]) {
    new query[256];
    new bool:isfriend = false;
    format(query, sizeof(query), "SELECT * FROM `Znajomi` WHERE (`Nick` = '%s' AND `Znajomy` = '%s' AND `Akceptowane` = '0') OR (`Nick` = '%s' AND `Znajomy` = '%s' AND `Akceptowane` ='0')",
    GetPlayerNick(playerid), friend, friend, GetPlayerNick(playerid));
    mysql_query(query);
    mysql_store_result();
    isfriend = mysql_num_rows()>0;
    mysql_free_result();
    return isfriend;
}

stock IsAcceptedFriend(playerid, friend[]) {
    new query[256];
    new bool:isfriend = false;
    format(query, sizeof(query), "SELECT * FROM `Znajomi` WHERE (`Nick` = '%s' AND `Znajomy` = '%s' AND `Akceptowane` = '1') OR (`Nick` = '%s' AND `Znajomy` = '%s' AND `Akceptowane` = '1') ",
    GetPlayerNick(playerid), friend, friend, GetPlayerNick(playerid));
    mysql_query(query);
    mysql_store_result();
    isfriend = mysql_num_rows()>0;
    mysql_free_result();
    return isfriend;
}

stock AcceptFriend(playerid, friend[]) {
    new query[256];
    format(query, sizeof(query), "UPDATE `Znajomi` SET `Akceptowane` = '1' WHERE (`Nick` = '%s' AND `Znajomy` = '%s') OR (`Nick` = '%s' AND `Znajomy` = '%s')",
    GetPlayerNick(playerid), friend, friend, GetPlayerNick(playerid));
    mysql_query(query);
}
Reply
#3

Doesn't work.
Errors are still.
Reply
#4

I fix it.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)