RopeADope Posted February 18, 2011 Share Posted February 18, 2011 Hi all. The title pretty much says it all. I really have no idea if this is even possible or where to start. A recent dilemma caused me to have to change a field name with some spaces in it. I have a database with ~65 tables, a majority of which were converted from Access. So I'm curious as to how many others have bad field names. Is there a way to use PHP to go through all the field names in a database and remove spaces? Link to comment https://forums.phpfreaks.com/topic/228107-recursively-change-database-field-names-with-php/ Share on other sites More sharing options...
BlueSkyIS Posted February 18, 2011 Share Posted February 18, 2011 Is there a way to use PHP to go through all the field names in a database and remove spaces? yes. you can use SQL to get the column names of each table, then look for spaces in those column names. if spaces are found, remove or replace the space in the field name, then MODIFY TABLE to change the field name from the old name to the new name. Link to comment https://forums.phpfreaks.com/topic/228107-recursively-change-database-field-names-with-php/#findComment-1176284 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.