Good afternoon, my friends, my problem today is this. I have the following query:
set @row_number = 0;
SELECT @row_number:=@row_number+1 AS row_number,il.* from itemloja il order by il.LojaId
As you can see, there are two that depend. I want to get the result of it in PHP, so use
$results = $go->fetchAll(PDO::FETCH_ASSOC);
However, it is giving the following error:
General error 'PDOStatement-> fetchAll (2)
I've already tried FETCH_ORI_FIRST
with FETCH_ORI_NEXT
and it did not work either.
Does anyone know how I can resolve this?
EDIT
This is my code
$Query = "set @row_number = 0;
SELECT @row_number:=@row_number+1 AS row_number,il.*
from itemloja il order by il.LojaId";
$go = $pdo->prepare($Query);
$go->execute();
$results = $go->fetchAll(PDO::FETCH_ASSOC);