PDO rename table Function rename a table from database operation using GOModel


Rename table function allows to rename a table specifying the old table-name and new table-name

Function Defination

                                void function renameTable($oldDBTableName, $newDBTableName);

Parameters Details

Details Type Example
$oldDBTableName - table name to be renamed from database string e.g. "emptable"
$newDBTableName - new table name string e.g. "empnewtable"


                                $GOModel = new GOModel(); //create object of the GOModel class
                                $GOModel->connect("localhost", "root", "", "database");//connect to database
                                /* Get all tables function */
                               $GOModel->renameTable("country", "countryTable");         

More Examples

                                //Example 1 - with column fetch mode
                                if($GOModel->renameTable("dbtablename", "newtablename");)
                                    echo "table renamed";;


Return true if table renamed successfully


Option Details Example
$GOModel->getLastQuery(); Return last query executed RENAME TABLE `dbtablename` TO `newtablename`
print_r($GOModel->error) Print errors (if any)