Home > Article > Backend Development > How to change the php table name
How to change the php table name
Here we use mysqli process-oriented method to connect to the database and execute the change table name operation.
Use ALTER TABLE `a` RENAME TO `b`; statement to modify the table name.
<?php $serve = 'localhost:3306'; $username = 'root'; $password = 'admin123'; $dbname = 'examples'; $link = mysqli_connect($serve,$username,$password,$dbname); mysqli_set_charset($link,'UTF-8'); // 设置数据库字符集 $result = mysqli_query($link,'ALTER TABLE `a` RENAME TO `b`'); if($result){ echo '更名成功'; }else{ echo '更名失败'; } ?>
For more PHP related knowledge, please visit PHP Chinese website!
The above is the detailed content of How to change the php table name. For more information, please follow other related articles on the PHP Chinese website!