sscanf warning: Invalid data length.
#1

Sscanf is showing an error in server_logs, how can I fix it.

SSCANF ERROR:
Код:
sscanf warning: Invalid data length.
sscanf warning: Invalid character in data length.
This place creates error, but I don't know how to fix it:
Код:
`Moqmedeba` 'created'
Код:
format(query, sizeof(query),"INSERT INTO `logs_cctv`(`Name`, `CCTVName`, `Date`, `Moqmedeba`<--this creates warning) 
VALUES ('%s','%s','%s', 'created' <----along with this one)", sendername, name, datum);
mysql_tquery(handlesql, query);
Everything is good in mysql database. But Sscanf still keeps showing this warnings
Reply
#2

Show us the sscanf line, not format.
Reply
#3

Quote:
Originally Posted by Stinged
Посмотреть сообщение
Show us the sscanf line, not format.

there is no sscanf line, this is the whole creating script, and the error hides within that ('created') message when I remove it warning doesn't appear.
Код:
CreateCCTV(playerid, name[])
{
    new id = Iter_Free(CCTVIter);
    if(id != -1)
    {
        new
            Float: x, Float: y, Float: z;
        GetPlayerPos(playerid, x, y, z);

        CCTVInfo[id][cctv_X] = x;
        CCTVInfo[id][cctv_Y] = y;
        CCTVInfo[id][cctv_Z] = z;

        CCTVInfo[id][cctv_rotX] = 0.0;
        CCTVInfo[id][cctv_rotY] = 0.0;
        CCTVInfo[id][cctv_rotZ] = 0.0;

        CCTVInfo[id][cctv_VW] = GetPlayerVirtualWorld(playerid);
        CCTVInfo[id][cctv_Interior] = GetPlayerInterior(playerid);
        strcpy(CCTVInfo[id][cctv_Name], name, MAX_CCTV_NAME);

        CCTVInfo[id][cctv_Object] = CreateDynamicObject(1886, CCTVInfo[id][cctv_X], CCTVInfo[id][cctv_Y], CCTVInfo[id][cctv_Z], CCTVInfo[id][cctv_rotX], CCTVInfo[id][cctv_rotY], CCTVInfo[id][cctv_rotZ], CCTVInfo[id][cctv_VW]);

        Iter_Add(CCTVIter, id);
        mysql_tquery(handlesql, "INSERT INTO `cctv` (`cctv_x`) VALUES (0)", "OnCCTVCreated", "d", id);
        
        new sendername[MAX_PLAYER_NAME], query[128];
        format(sendername, sizeof(sendername), "%s", PlayerName(playerid));
  		GiveNameSpace(sendername);
		new year,month,day, datum[64];
		getdate(year, month, day);
		format(datum, sizeof(datum), "%d-%d-%d", year, month, day);
        format(query, sizeof(query),"INSERT INTO `logs_cctv`(`Name`, `CCTVName`, `Date`, `Moqmedeba`) VALUES ('%s','%s','%s', 'created')", sendername, name, datum);
		mysql_tquery(handlesql, query);
    }
    return id;
}
Reply
#4

All the way to the top
Reply
#5

Maybe the format functions is somehow edited? Because i can't see any of sscanf functions here.
Didn't you try to use
Код:
mysql_format?
Reply
#6

Unrelated to your issue, but sanitize your database inputs!
PHP код:
mysql_format(handle_varquerysizeof(query), "INSERT INTO table (someString) VALUES ('%e')"someString); 
The %e specifier only works with mysql_format and escapes strings for you.
Reply
#7

Still the same problem guys, tried everything
Reply
#8

Can you show us where you're calling CreateCCTV?
I mean also show some code around that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)