0
$prepare=$text->prepare("
select *
from (
select text1,text2
from test1
union
select text1,text2
from test2
) as u
where u.text1 in (?,?)");
$prepare->execute($array);
$fetch=$prepare->fetch(PDO::FETCH_ASSOC);
print_r($fetch);
我有一個在所有使用UNION,WHERE和IN的PDO語句。這應該返回一些結果。該數組包含所有數據點。聲明中可能存在什麼問題?PDO聯合在哪裏和在
確定。但我嘗試了沒有IN的測試。只要做「select * from(select text1,text2 from test1)as u」,當數據庫中有8個以上時,我只得到1個結果。 –
只有「select text1,test1 from test1」才能得到多少行? –
你只有一行嘗試從PHP或從MySQL控制檯?您錯誤地使用了獲取語句 –