Trying to figure out how to include a return for the row position in the result set. It is a very simple table that is ordered by computer_id
with a WHERE clause. All I am looking for is something like (*row position*) as position
in the results for each.
I found a few things by searching here on SO, but nothing I was able to get working.
$stmt = $db->prepare("
SELECT *
FROM computers
WHERE account_id = :account_id
ORDER BY computer_id
");
$stmt->bindValue( ':account_id', $_SESSION['user']['account_id'] );
$stmt->execute();
$results = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo '<pre>',print_r($results,1),'</pre>';