MySQL issue
#1

pawn Код:
format(szQuery, sizeof(szQuery), "INSERT INTO `Points` (`opCoX`, `opCoY`, `opCoZ`, `opCoA`) VALUES (%f, %f, %f, %f) WHERE `pID` = %d", positions[0], positions[1], positions[2], positions[3], id);
    mysql_function_query(dbHandle, szQuery, false, "thread_InsertPoint", "d", playerid);
I have this and get this error.
Код:
[17:05:44] [WARNING] CMySQLHandler::FreeResult() - The result is already empty.
[17:06:03] [ERROR] ProcessQueryThread(thread_InsertPoint) - 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 (`pID` = 6)' at line 1 (error ID: 1064)
What's the correct syntax, if not WHERE `pID` = %d or WHERE (`pID` =%d)?
Reply
#2

I think it's: WHERE ('ID' = %d)
Reply
#3

No, it's not.
Reply
#4

Try this

pawn Код:
format(szQuery, sizeof(szQuery), "INSERT INTO Points (opCoX, opCoY, opCoZ, opCoA) VALUES ('%f', '%f', '%f', '%f') WHERE pID = '%d'", positions[0], positions[1], positions[2], positions[3], id);
        mysql_function_query(dbHandle, szQuery, false, "thread_InsertPoint", "d", playerid);
Reply
#5

Isn't ' and ' used for strings? Like '%s'? I'll try it out in a bit though, thanks.
Reply
#6

You can't use the "where" clause in a "insert" query..

(Do you need to insert a new line or just update an existing one ? For inserting a new line you use insert,and for updating an existing line you use UPDATE)
Reply
#7

@InfiniTy. Thank you, that's how it's done.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)