MySql + InnoDB + PHP Single Quote Discrimination? -


okay, i've converted number of tables innodb storage engine , i've been getting errors whenever use single-quote ' in column list of insert statement:

insert 'table' ('col1', 'col2') values ('val1', 'val2') 

when tired using phpmyadmin generate proper statement, looked virtually same, pasted in app, , worked. next statement had same error started suspicious. after bit of playing around found problem query needed back-tick instead of single-quotes, not whole thing.

insert `table` (`col1`, `col2`) values ('val1', 'val2') 

works, it's not mysql doesn't understand single-quote. going on here? can't leave columns unquoted before myisam (ie: table(col1, col2))

that's because single quotes denote string literals, whereas backticks denote database/table/column identifier escapes.

removing backticks causes error because table reserved word, in order use table name have include backticks.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -