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

Description

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"

Examples

  
                                $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";;
                            

Result/Output

Return true if table renamed successfully

Debug

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