galili Posted July 13, 2018 Share Posted July 13, 2018 Folks, whats wrong with this statement on mysqli $sql = "ALTER TABLE bethany RENAME COLUMN `SALE PRICE` TO `saleprice`"; $mysqli->query($sql); Link to comment Share on other sites More sharing options...
Barand Posted July 13, 2018 Share Posted July 13, 2018 Quite a lot. Assuming it is currently defined as `SALE PRICE` DECIMAL(12, 2) NOT NULL DEFAULT 0 then you need ALTER TABLE bethany CHANGE COLUMN `SALE PRICE` saleprice DECIMAL(12, 2) NOT NULL DEFAULT 0 Link to comment Share on other sites More sharing options...
requinix Posted July 13, 2018 Share Posted July 13, 2018 RENAME COLUMN requires MySQL 8.0 so apparently you don't have that. Link to comment Share on other sites More sharing options...
benanamen Posted July 13, 2018 Share Posted July 13, 2018 OP, Why are you writing Php code for what should be a onetime DB alteration? The command line, Phpmyadmin or some other GUI that works directly on the DB makes much more sense. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.