I'am at loss here. Not sure why I'm getting "stdClass". Shouldn't I be getting name from 1st column?
$sql = "SELECT cn, iso2, iso3, fid, sort FROM ct"; $stmt = $dbh->query($sql); $result = $stmt->fetch( PDO::FETCH_CLASS | PDO::FETCH_CLASSTYPE ); var_dump($result); //expected - first: cn.col holds country names object(Brazil)[3] public 'iso2' => string 'BR' (length=2) public 'iso3' => string 'BRA' (length=3) public 'fid' => string '1' (length=1) public 'sort' => string '0' (length=1) //received object(stdClass)[3] public 'iso2' => string 'BR' (length=2) public 'iso3' => string 'BRA' (length=3) public 'fid' => string '1' (length=1) public 'sort' => string '0' (length=1)var_dump
get_class($result)
? – Mike Purcell