Copy link to clipboard
Copied
Why I try this in one database and it doesn't work:
$query_Recordset1 = sprintf("SELECT * FROM change WHERE change.Changes_made LIKE %s", GetSQLValueString("%" . $colname_Recordset1 . "%", "text"));
but why i put quotes then it works
$query_Recordset1 = sprintf("SELECT * FROM `change` WHERE `Changes_made` LIKE %s", GetSQLValueString("%" . $colname_Recordset1 . "%", "text"));
I tried this on another database and the query works without the quote. Can anyone explain this strange phenomenon?
'Change' is a MySQL reserved words and therefore must be 'quoted'.
Copy link to clipboard
Copied
'Change' is a MySQL reserved words and therefore must be 'quoted'.
Copy link to clipboard
Copied
Thanks, I will be sure to avoid the reserved word, or else I will have the trouble of putting lots of quotes.
The link to the SQL 5.1 reserved words is shown below:
Copy link to clipboard
Copied
So far this is what I found out:
You will only put ` `(the character found below the escape key) on fields containing SQL reserved words. This applies to SELECT,DELETE,UPDATE commands.
For parameters(containing reserved words) passed using the GET,POST method, no need to put the ` `.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now