Using the Sql ALTER TABLE statement, it is possible to rename a MySQL tables name in PHP.
syntax:
ALTER TABLE old_table_name RENAME TO new_table_name
<?php
$dbhost = "localhost";
$dbuser = "your_username";
$dbpass = "your_password";
$dbname = "basename";
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql = "ALTER TABLE memebers RENAME TO profils";
if (mysqli_query($conn, $sql)) {
echo "The table of members changed name.";
} else {
echo "The table of members name has not been changed." . mysqli_error($conn);
}
mysqli_close($conn);