Trace:
Differences
This shows you the differences between two versions of the page.
moodle:database_access [2011/09/02 12:23] onno [Database Access] |
moodle:database_access [2012/01/11 14:32] (current) onno [DB Abstraction Layer (DML) Issues] |
||
---|---|---|---|
Line 49: | Line 49: | ||
The only solution is to check your sql and replace all occurrences of a colon followed by a non-space character, with a colon and a white space character. | The only solution is to check your sql and replace all occurrences of a colon followed by a non-space character, with a colon and a white space character. | ||
+ | |||
+ | Generally speaking, this format seems to be the most robust: | ||
+ | |||
+ | <code> | ||
+ | if (! ($records = $DB->get_records_select("compass_elements", | ||
+ | "category_id = ? AND label = ? ", | ||
+ | array('category_id' => $category_id, 'label' => $label))) ) | ||
+ | return false; | ||
+ | </code> | ||
+ | |||
+ | In other words: don't use quotes around strings, do use question marks as place holders. | ||
+ | |||
You are here: start » moodle » database_access