$this->db->query("INSERT INTO products
(name, price, description, stock)
VALUES ('$name', '$price', '$description', '$stock')");
$this->db->query("INSERT INTO products (category)
SELECT id
FROM categories
WHERE category_name = '$category'");
These queries work fine if run individually, but how do I run them together? I am trying to add product data to a table and also get the category id and insert it at the same time.