How to add a column to a table using a query?
Hello there, I am writing a gamemode and I am using sqlite3 for saving. Now when I need to add a column that has a float value, I can not directly add that in the phpliteadmin interface. I can only add integers and text columns with phpliteadmin. The problem here is that I have to recreate the entire table just to add a float column. So currently I am looking for a way to add a float column to a table by using a query. This is what I've tried so far: ALTER TABLE CHARACTERS ADD BLOOD FLOAT NOT NULL DEFAULT 100.0 WITH VALUES ALTER TABLE CHARACTERS ADD BLOOD FLOAT DEFAULT 0.0 ALTER TABLE CHARACTERS ADD COLUMN BLOOD FLOAT DEFAULT 0.0 All 3 query's above gave me a really odd error: Error: That's right, the error was empty... Any help would be appreciated.
Works for me:
sqlite> create table characters([...]); sqlite> ALTER TABLE CHARACTERS ADD BLOOD FLOAT DEFAULT 0.0; sqlite> .schema CREATE TABLE characters([...], BLOOD FLOAT DEFAULT 0.0);I suspect that phpliteadmin is not able to access the file, or that the database is locked by another program.
As for the error message, you have to complain to the phpliteadmin authors.