Используя следующий код:Drupal 7 базы данных ошибок API
db_update('nodesequence_nodes')
->fields(array(
'order' => 1,
))
->condition('nid', 1, '=')
->condition('nsid', 1, '=')
->execute();
Я получаю следующее сообщение об ошибке:
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 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 'order='1' WHERE (nid = '1') AND (nsid = '1')' at line 1: UPDATE {nodesequence_nodes} SET order=:db_update_placeholder_0 WHERE (nid = :db_condition_placeholder_0) AND (nsid = :db_condition_placeholder_1) ; Array ([:db_update_placeholder_0] => 1 [:db_condition_placeholder_0] => 1 [:db_condition_placeholder_1] => 1 ) in nodesequence_init() (line 13 of /var/www/eventbooking2/sites/all/modules/nodesequence/nodesequence.module).
Прошу прощения, я не могу предложить в малейшей проницательность, но я надеюсь, что вы можете.
Простой Код db_update Мне кажется, что он должен работать, но я не могу понять, почему это не так. Пожалуйста, помогите.
Схема базы данных:
$schema['nodesequence_nodes'] = array(
'description' => 'Relating nodesequences to their consituent nodes.',
'fields' => array(
'nsid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE),
'nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE),
'order' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
),
'primary key' => array('nsid', 'nid'),
);
Выглядит хорошо для меня. Это обычная таблица? Если да, можете ли вы показать схему таблиц? –
Я только что включил схему базы данных. Спасибо – sisko