M
M
Maxim Timofeev2018-03-08 13:09:17
MySQL
Maxim Timofeev, 2018-03-08 13:09:17

What is wrong in mysql syntax?

Here is the request

INSERT INTO `articles_post` (`id`,`created_at`,`updated_at`,`user_id`,`title`,`content`,`excerpt`,`status`,`media_id`) VALUES
(`1`,`2017-12-11 11:31:22`,`2017-12-11 11:31:25`,`5`,`Test12`,``,``,`draft`,NULL);;;

gives error Unknown column '1' in 'field list'

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Rsa97, 2018-03-08
@webinar

Backticks `denote database names, tables, fields, aliases, and so on. Strings are denoted by straight single 'or double "quotes.

Y
Yuri Velmesov, 2018-03-08
@yury-gubsky

Well, to the above from Rsa97, I give the request itself, what it should be like in the end, pay attention to the direct single quotes:

INSERT INTO `articles_post` (
    `id`,
    `created_at`,
    `updated_at`,
    `user_id`,
    `title`,
    `content`,
    `excerpt`,
    `status`,
    `media_id`
) VALUES (
    '1',
    '2017-12-11 11:31:22',
    '2017-12-11 11:31:25',
    '5',
    'Test12',
    '',
    '',
    'draft',
    NULL
);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question