andyt683 Posted August 8, 2007 Share Posted August 8, 2007 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 More sharing options...
teng84 Posted August 9, 2007 Share Posted August 9, 2007 i guess the field where you are trying to supply a value is greater that the number of those values or vise versa Link to comment https://forums.phpfreaks.com/topic/63977-insert-with-subquery-error/#findComment-319024 Share on other sites More sharing options...
andyt683 Posted August 9, 2007 Author Share Posted August 9, 2007 Aside from the instance_id column, each table is identical. Link to comment https://forums.phpfreaks.com/topic/63977-insert-with-subquery-error/#findComment-319255 Share on other sites More sharing options...
fenway Posted August 15, 2007 Share Posted August 15, 2007 Um, the # of insert cols doesn't match the # of select cols... count again. Link to comment https://forums.phpfreaks.com/topic/63977-insert-with-subquery-error/#findComment-324723 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.