Jump to content

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.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.