Author Topic: Multiple Insert - Column count doesn't match value count at row 1  (Read 495 times)

0 Members and 1 Guest are viewing this topic.

Offline boo_lollyTopic starter

  • Devotee
  • Posts: 1,171
  • Gender: Male
  • dirka dirka dirka
    • View Profile
I cannot for the life of me figure this out. PhpMyAdmin puts there error somewhere around the word VALUES.
Code: [Select]
      INSERT INTO
        `tasks` (
          `id`,
          `challenge_id`,
          `title`,
          `frequency`,
          `category`,
          `description`
      )
      VALUES (
        (
          "",
          12,
          "title1",
          "frequency1",
          "category1",
          "somedesc1"
        ),
        (
          "",
          12,
          "title2",
          "frequency2",
          "category2",
          "somedesc2"
        ),
        (
          "",
          12,
          "title3",
          "frequency3",
          "category3",
          "somedesc3"
        )
      );

I have not left out any columns in the query on the table `tasks`. Can anyone else see what i'm doing wrong? I've been banging my head over this for like an hour...

Offline pbs

  • Enthusiast
  • Posts: 159
  • Gender: Male
    • View Profile
    • PBS
Re: Multiple Insert - Column count doesn't match value count at row 1
« Reply #1 on: March 10, 2010, 07:12:33 AM »
Try this


Code: [Select]
      INSERT INTO
        `tasks` (
          `id`,
          `challenge_id`,
          `title`,
          `frequency`,
          `category`,
          `description`
      )
      VALUES
        (
          "",
          12,
          "title1",
          "frequency1",
          "category1",
          "somedesc1"
        ),
        (
          "",
          12,
          "title2",
          "frequency2",
          "category2",
          "somedesc2"
        ),
        (
          "",
          12,
          "title3",
          "frequency3",
          "category3",
          "somedesc3"
        );


Warm Regards,
PBS | Ads

Offline boo_lollyTopic starter

  • Devotee
  • Posts: 1,171
  • Gender: Male
  • dirka dirka dirka
    • View Profile
Re: Multiple Insert - Column count doesn't match value count at row 1
« Reply #2 on: March 10, 2010, 07:16:11 AM »
pbs,

THAT TOTALLY WORKED!

I can see that I had an extra closing parenthesis at the end that was not necessary and the opening parenthesis right after VALUES was also not necessary
« Last Edit: March 10, 2010, 07:20:22 AM by boo_lolly »