Using the Sql ALTER TABLE statement, it is possible to rename a column name to the MySQL table in PHP.
syntax:
ALTER TABLE table_name CHANGE old_column_name new_column_name(type data)

Example:



<?php
$dbhost 
"localhost";
$dbuser "your_username";
$dbpass "your_password";
$dbname "basename";
$conn mysqli_connect($dbhost$dbuser$dbpass $dbname);
// Check connection
if (!$conn) {
die(
"Connection failed: " mysqli_connect_error());
}
$sql "ALTER TABLE members
CHANGE lastname nickname varchar(30)"
;
if (
mysqli_query($conn$sql)) {
echo 
"The column lastname has been changed.";
} else {
echo 
"The column lastname has not been changed." mysqli_error($conn);
}
mysqli_close($conn);
 
?>