I am having some problems with a query because of errors in the code that I did not create.
$query = $this->db->query("ALTER TABLE `" . DB_PREFIX . "customer` ADD `customer_type` TINYINT(1) NOT NULL;
I'm not a coder, but have so far fixed (I think) the error. By comparing with other queries that don't throw errors and reading quite a few similar posts on stackoverflow, I added a missing quote, a parenthese, and semi-colon. No more error, but not sure if this is even the correct way of doing it? I ended up with this:
$query = $this->db->query("ALTER TABLE `" . DB_PREFIX . "customer` ADD `customer_type` TINYINT(1) NOT NULL;");
But now, I get a duplicate column error 1060 "duplicate column name". So I did the same thing, googled the heck out of it, search stackoverflow and found some examples using aliases and a bunch of extra lines of code which is way above my head. This code lives in side a .php file, would someone kindly hold my hand through this? You could consider it your good deed for the day! Thanks for your time.
解决方案
It means that the column already exists in your table, most likely the former programmer wanted to add the column and forgot to delete the query aftewrads.