Mysql saving
#1

i made a system for saving and loading,it loads right but when i save it saves wrong ,everything gets messed,like num stays 3 while it has been set to 0,here is the code
pawn Код:
forward SaveIds();
public SaveIds()
{
    for(new id = 0; id < MAX_IDS; id++)
    {
            new query[128];
            mysql_format(mysqlquery, query, sizeof(query), "UPDATE `ids` SET `IDSet`=%d, `IDDone`=%d, `IDPosX`=%f, `IDPosY`=%f, `IDPosZ`=%f,`IDPosA`=%f, `IDNum`=%d, `IDAmount`=%d, `IDType`=%d, `IDTypename`='%s', `IDMoveX`=%f, `IDMoveY`=%f, `IDMoveZ`=%f  WHERE `ID`=%d",
            IdInfo[id][idset], IdInfo[id][iddone], IdInfo[id][idposx], IdInfo[id][idposy], IdInfo[id][idposz],
            IdInfo[id][idposa], IdInfo[id][idnum], IdInfo[id][idamount], IdInfo[id][idtype], IdInfo[id][idtypename]
             ,IdInfo[id][idmovex], IdInfo[id][idmovey], IdInfo[id][idmovez], id);
            printf("\n %s", query);
            mysql_tquery(mysqlquery, query);
            printf("Saved ID %d", id);
    }
    return 1;
}
NOTE:it prints the query right but saves wrong in database
Reply
#2

Anyone?
Reply
#3

Anyone?come on
Reply
#4

Have you copied the query that it prints to the console and then tried running that from within phpmyadmin or sometihng? just to make 100% sure that the query syntax is correct?
Reply
#5

Quote:
Originally Posted by iBots
Посмотреть сообщение
NOTE:it prints the query right but saves wrong in database
Hi iBots,

Can you please show us what is printed in the server log?
Reply
#6

1. For all string output values to mySQL I would recommend using %e, instead of %s when formatting strings. This will increase security and avoid SQL injections.
2. Enable SQL debugging: mysql_debug(); under OnGameModeinit. Then, open mysql_log.txt in your server root and paste the result. Perhaps you have an invalid field type in your table?

Is it saving at all?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)