blacknight Posted December 16, 2006 Share Posted December 16, 2006 ok i need help i have a page i have coded and i have made a newer version and added collums to the table how would i go about comparing the 2 tables colums and adding the missing collums to a array to be used in an alter table query this is the old structure[code] CREATE TABLE `tablename` `id` int(11) NOT NULL auto_increment, `file` varchar(255) NOT NULL default '', `caption` varchar(255) NOT NULL default '', `ext` varchar(255) NOT NULL default '', `catagory` varchar(255) NOT NULL default '', `approve` varchar(3) NOT NULL default '', PRIMARY KEY (`id`) ) [/code]and this si the new one[code] CREATE TABLE `".ROSTER_SCREENTABLE."` ( `id` int(11) NOT NULL auto_increment, `file` varchar(255) NOT NULL default '', `caption` varchar(255) NOT NULL default '', `ext` varchar(255) NOT NULL default '', `catagory` varchar(255) NOT NULL default '', `approve` varchar(3) NOT NULL default '', `votes` varchar(10) NOT NULL default '', `rateing` varchar(10) NOT NULL default '', PRIMARY KEY (`id`) ) [/code]any help guys Quote Link to comment https://forums.phpfreaks.com/topic/30830-resolved-mysql-table-structures/ Share on other sites More sharing options...
trq Posted December 16, 2006 Share Posted December 16, 2006 Read your post. Can you understand where and what the question is? Quote Link to comment https://forums.phpfreaks.com/topic/30830-resolved-mysql-table-structures/#findComment-142281 Share on other sites More sharing options...
Hypnos Posted December 16, 2006 Share Posted December 16, 2006 If I'm understanding you right...Have your normal MySQL while loop with fetch_array, check each to see if there is a match with a query in the while loop, if there isn't, an insert the current array in to the new table.Although you probably want to echo those insert queries until you're sure it's working correctly. Debugging stuff that's modifying your database isn't fun. Quote Link to comment https://forums.phpfreaks.com/topic/30830-resolved-mysql-table-structures/#findComment-142291 Share on other sites More sharing options...
blacknight Posted December 16, 2006 Author Share Posted December 16, 2006 its ok if yall dont understand i got it figured out i made an array if the fields in the new table and compared them to the old one and mafe a for loop to alter the old table adding the new fields to it :) Quote Link to comment https://forums.phpfreaks.com/topic/30830-resolved-mysql-table-structures/#findComment-142555 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.