SQL Question.
#1

Hi, I am learning SQLite and maybe soon MySQL (after the final exams on school).
I would like to ask a question about the UPDATE Statement.
Which from both is the correct because the compiler doesn't respond when I am trying to compile it.
Or something on this is wrong `Field` or something at my code because it's very big.
PHP Code:
new
    
Query[ 200 ],
    
name[ MAX_PLAYER_NAME ];
GetPlayerName( playerid, name, sizeof( name ) );
format( Query, sizeof( Query ), "UPDATE `Users` SET `Score` = '%d' WHERE `Username` = '%s' COLLATE NOCASE", GetPlayerScore( playerid ), DB_Escape( name ) );
db_query( Database, Query ); 
OR
PHP Code:
new
    
Query[ 200 ],
    
name[ MAX_PLAYER_NAME ];
GetPlayerName( playerid, name, sizeof( name ) );
format( Query, sizeof( Query ), "UPDATE `Users` SET Score = '%d' WHERE `Username` = '%s' COLLATE NOCASE", GetPlayerScore( playerid ), DB_Escape( name ) );
db_query( Database, Query ); 
The first is `Score` and the second is Score

Regards,

Edit: Solved, thanks to all!
Reply
#2

` is used to differentiate between SQL Commands and data.
Reply
#3

Edit: SOLVED
Reply
#4

it should be with ` & `
Reply
#5

Edit: SOLVED
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)