Why doesn’t this code add a table to my database?

A key must be defined for a table by using a single column, or multiple. So on your code, you need to a line to the sql KEY id (id)

$sql = "CREATE TABLE $table_name (
    id int NOT NULL AUTO_INCREMENT,
    feedurl text NOT NULL,
    category text NOT NULL,
    KEY  id (id)
);";