I am using drupal 7.41, I have a database table and it contains an auto incremented column/field. I am trying to insert some data into that table by using db_insert
but it keeps displaying syntax error. Am I missing something in this syntax?
db_insert('my_table')
-> fields(array(
'id' => NULL, //my auto incremented field...
'name' => $form_state['values']['name'],
'link' => $form_state['values']['link],
'group' => 2 /* I have already tried this field with and without integer data and string data. Eg '2' and 2*/
)) -> execute();
My mysql table contains four columns: id (Auto incremented, int), name (varchar(50)), link(varchar(200)), group (int).
I have tried every syntatic way but no to avail. And lastly here is my error message when I execute the query above:
I think there is no access violation here, since I was able to insert some other rows into different tables. Only difference is that that table has no auto incremented integer field and other integer fields. Just two varchar fields.
Thank you.