Fatal error: Call to undefined method PDOStatement::fetch_as

Connect with other users about what to run on your webhosting (and how to run it) here.
Post Reply
flux
New to forums
New to forums
Posts: 8
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Sun Nov 24, 2013 3:08 am

Fatal error: Call to undefined method PDOStatement::fetch_as

Post by flux »

The Error
http://puu.sh/5uqLX.png

The code

Code: Select all

 $found_rows = $count_rows->fetch_assoc();
User avatar
Spray
Former staff
Former staff
Posts: 630
Joined: Wed Dec 28, 2011 10:41 pm
Location: Oregon

Re: Fatal error: Call to undefined method PDOStatement::fetc

Post by Spray »

The error is correct, fetch_assoc is not a method of the PDOStatement class.

Assuming that $count_rows is a valid result set, try this following:

Code: Select all

$found_rows = $count_rows->fetch(PDO::FETCH_ASSOC);
flux
New to forums
New to forums
Posts: 8
Joined: Sun Nov 24, 2013 3:08 am

Re: Fatal error: Call to undefined method PDOStatement::fetc

Post by flux »

Spray wrote:The error is correct, fetch_assoc is not a method of the PDOStatement class.

Assuming that $count_rows is a valid result set, try this following:

Code: Select all

$found_rows = $count_rows->fetch(PDO::FETCH_ASSOC);
Worked, thanks a lot man :)
Post Reply