Possible Duplicate:
Is there an equivalent for MySQL's “multi_query()” in PDO?
I have two table, I do a union from two table:
select *
from table1
union
select *
from table2
I would want create an auto increment column on the fly for creating "more results" pagination passing this auto increment id as offset.
I can create auto increment column on the fly in this way:
SELECT @i:=0;
SELECT all_res.*,
@i:=@i+1 AS i
FROM (
select *
from table1
union
select *
from table2
) as all_res
but if I run queries in php pdo I obtain this error:
SQLSTATE[42000]: Syntax error or access violation: 1064 SELECT all_res.*, @i:=@i+1 AS i' at line 1
How can I do for obtain an unique column id to be able to "view more results"?