Jump to content

INSERT with subquery error


andyt683

Recommended Posts

In table 1, we have a "defaults" table. When a user creates a new instance, the defaults are copied into a "running" table, with their ID and the instance # attached, along with all the data from the defaults table. The instance is then run from the "running" table. Thats the theory, at least.

 

$uniqid is a static number, an amalgam of the users' ID and the instance ID.

 

INSERT INTO `mission_run` (`instance_id`,`id`,`x`,`y`,`owner`,`passable`,`soldiers`) VALUES('$uniqid', (SELECT `id`,`x`,`y`,`owner`,`passable`,`soldiers` FROM `mission_start` WHERE `id` = '1' ORDER BY x ASC, y ASC))

 

MySQL said:

 

Column count doesn't match value count at row 1

 

SELECTING `id`,`x`,`y`,`owner`,`passable`,`soldiers` FROM `mission_start` WHERE `id` = '1' returns the following data:

id    x    y    owner    passable    soldiers

1 0 6 0 0 0

1 0 7 0 0 0

1 0 5 0 0 0

 

Any ideas?

Link to comment
https://forums.phpfreaks.com/topic/63977-insert-with-subquery-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.