Page 1 of 1

php to compare structure of mysql tables

Posted: Sat Jul 23, 2011 12:13 pm
by mottwsc
I'm trying to compare the structure of two mysql tables using php to determine if there are differences in the structures and then output where there are differences. I heard that there is a diff function, but I don't know how to access that via php. Can anyone provide guidance or code samples to help?

Thank you.

Re: php to compare structure of mysql tables

Posted: Tue Jul 26, 2011 4:10 am
by Benjamin
Essentially you would want to load the details of each table into an array and iterate through them or use PHPs built in array diff functions.

It sounds like you ought to have the secondary server setup as a slave server though, updated by the master automatically.