Hai everybody,
i have problem in following query.

this query working fine in seperated,

i add two array value.

totalcount display first value.
what is the problem in my query.

anybody plx help me

$sql="SELECT count( DISTINCT friendoffriends_id ) AS count
                                from mycommunity
                                    WHERE personal_id =:personal_id
                                    and blocked=0 ";


        $query = $db->prepare($sql); 
        $query->execute(array('personal_id' => $this->personal->getId()));
        $this->communityunblock = $query->fetchAll();


        $this->totalunblockcount =$this->communityunblock + $this->friendsunblock;
        var_dump($this->totalunblockcount);

`

you applying count and distinct function together i don't think it will work for you
distinct function gives you one record for repeated records
and count function counts all the records in from a table.
you have to change your query otherwise you get error

Member Avatar
diafol

Should be:

$query->execute(array(':personal_id' => $this->personal->getId()));

Note the colon.