i am learning php and mysql database, i know how to query and update in two separate quqeries, but i was wondering if its possible to do a SELECT and UPDATE in one query? like this for example

$sql = "SELECT hits FROM counter WHERE id = 23";

$sql = "UPDATE counter SET hits=24"