Jump to content

[ resolved ] mysql table structures


blacknight

Recommended Posts

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
Link to comment
https://forums.phpfreaks.com/topic/30830-resolved-mysql-table-structures/
Share on other sites

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.

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.