Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9139485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:23:38+00:00 2026-06-17T09:23:38+00:00

I try a simple insert query in Drupal 7 , but it always return

  • 0

I try a simple insert query in Drupal 7, but it always return with error.
I tried out db_insert, drupal_write_record, and db_query also, but every functions return various errors.

I have a tabledrag_menu table:

enter image description here

I have an $adat array:

Array
(
    [name] => Overview
    [weight] => 0
    [group] => left
    [checked] => 0
    [tid] => 96
    [nid] => 20
)

With var_dump it looks like this:

array(6) { ["name"]=>   string(8) "Overview"   ["weight"]=>   int(0)   ["group"]=>   string(4) "left"   ["checked"]=>   int(0)   ["tid"]=>   int(96)   ["nid"]=>   int(20) } 

My code, which gives the error:

$id = db_insert('tabledrag_menu')->fields($adat)->execute();

When i use the db_insert, it return with this error message:

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 ‘group, checked, tid, nid) VALUES (‘Overview’, ‘0’, ‘left’, ‘0’,
’96’, ’20’)’ at line 1: INSERT INTO {tabledrag_menu} (name, weight,
group, checked, tid, nid) VALUES (:db_insert_placeholder_0,
:db_insert_placeholder_1, :db_insert_placeholder_2,
:db_insert_placeholder_3, :db_insert_placeholder_4,
:db_insert_placeholder_5); Array ( [:db_insert_placeholder_0] =>
Overview [:db_insert_placeholder_1] => 0 [:db_insert_placeholder_2] =>
left [:db_insert_placeholder_3] => 0 [:db_insert_placeholder_4] => 96
[:db_insert_placeholder_5] => 20 )

I think, this part causes the error, but i don’t know how to fix it:

VALUES (‘Overview’, ‘0’, ‘left’, ‘0’,
’96’, ’20’)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:23:39+00:00Added an answer on June 17, 2026 at 9:23 am

    Group is MySql reserved word. Try using some other name for that field.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I thought I'd try a simple GUI app using the world/universe mutation-free approach, but
I have a simple TRY CATCH with an embedded TRANSACTION in the below query.
I've made a temp site to try out a script I'm adapting upon (simple
Ok I have a very simple mysql database but when i try to run
I'm trying to do a simple insert query in mysql using java. How do
How do I get id of an insert query? Simple: insert into Ex(sth) values(value);
I am using a simple try-with-resources statement like the following: try (final CSVWriter w
in simple I try do that in PhpMyAdmin: update wp_postmeta.meta_value = wp_posts.id where wp_posts.post_name=articles.image
Hi I want to try making a simple application for android phones for which
i have downloaded Swift Mailer from their website and try to send simple email

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.