Home Illegal string PDO fetch() vs fetchAll()
Reply: 0

Illegal string PDO fetch() vs fetchAll()

user471 Published in July 16, 2018, 8:35 pm

When I try to call fetch() after executing a PDO statement, I get the following warning:

Warning: Illegal string offset

It works perfectly when I use fetchAll(), though.

What's the difference between the two, and how would I use either one?

$allData = $con->prepare("SELECT * FROM users");
$result = $allData->fetch();
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.325238 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO