How do I remove variables from the variable table when my module uninstalls? I'm working on a Drupal 6 module that adds some variables to the variable table. How can I go about having those variables removed from the variable table when the module is uninstalled?
Keep track of your variables and add appropriate variable_del() calls within an implementation of hook_uninstall():

function foo_uninstall() {
  variable_del('foo_variable1');
  variable_del('foo_variable2');
}


As hook_uninstall() is an installation hook, it needs to reside in your module's .install file (e.g. foo.install).

You ought not to delete all variables prefixed with your module's name as namespace collisions will come back to bite you. For example, if your module's name is foo, you might think you should just poll the variables table for all variables prefixed foo_. But what if I write a module named foo_awesome? You'd delete my variables, too. That wouldn't be nice.