I want to drop a field from db table which is named as read. I tried like;

db_drop_field('my_table', 'read');
db_drop_field('my_table', '`read`');
db_drop_field('my_table', `read`);

None of these work.

up vote 0 down vote accepted

Just run a custom query:

db_query('ALTER TABLE my_table DROP COLUMN `read`');

The API functions don't cover every possible edge case, and dropping fields named as reserved words happens to be one of them.

When that fails, executing a standard SQL query is the best option.

  • Was just about to suggest using a mysql client to do that work - sometimes these things cannot be done from code. – Kevin Aug 23 at 16:04
  • If you can do it from any other client, you can do it from PHP @Kevin - they're using the same protocols under the hood – Clive Aug 23 at 16:13

Read is a reserved word, but your problem has an easy solution (I test it and works)

Change your field name to reading

And then use:

db_drop_field('your_table', 'reading');

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.