I would like to run a query that adds 1 to the qa_votes field, and then retrieves the resulting value of that field so I can show it on the front end.
So the code draft would be
$this->db->query("
UPDATE qa
SET qa_votes = qa_votes +1
WHERE qa_id = $question_id;
");
followed by
$query = $this->db->query("
SELECT qa_id, qa_votes
FROM qa
WHERE qa_id = $question_id;
");
Is there a way of combining these 2 into a single query?
Short answer: No.
Long Answer: Not with an out-of-the-box command.
UPDATEcommand does not provide that. You could, however, write a Stored Procedure that updates and then brings back the result.