galili Posted July 13, 2018 Share Posted July 13, 2018 (edited) Folks, whats wrong with this statement on mysqli $sql = "ALTER TABLE bethany RENAME COLUMN `SALE PRICE` TO `saleprice`"; $mysqli->query($sql); Edited July 13, 2018 by galili Quote 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 1 Quote 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. Quote Link to comment Share on other sites More sharing options...
benanamen Posted July 13, 2018 Share Posted July 13, 2018 (edited) 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. Edited July 13, 2018 by benanamen Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.