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? Quote 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 Quote 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. Quote 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. Quote Link to comment https://forums.phpfreaks.com/topic/63977-insert-with-subquery-error/#findComment-324723 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.