phpmysqlzend-frameworkzend-amf

zend amf can not return big-int of MySQL database?


Well here is my query and and it works fine and the field friend_id is of type MySQL big-int

"SELECT friend_id FROM users_friends uf WHERE uf.user_id=1192134553 limit 2"

and the query returns the required result i.e 100002407532395 , 100002307531370

now here is my service zend/amf service

public function  GetUserAllFreinds($user_id)
{
    $sql    =    "SELECT friend_id FROM  users_friends uf WHERE uf.user_id=$user_id limit 2";
    $res    =    mysql_query($sql) or die(debug($sql).mysql_error());
    return $res;    
}

And the service returns me 2147483647. However when i set friend_id to MySQL varchar, it works. why it does not work for big-int??


Solution

  • Try putting the annotations before the service method, as follows:

    /**
    @param int $user_id
    @return int
    */
    

    Also, your code is returning the result of mysql_query. Shouldn't process the result before returning it?

    $values = array()
    while ($row = mysql_fetch_assoc($result)) {
        $values[] = $row['friend_id'];
    }
    

    and then, returning the $values, setting @return to array instead of int.