Manash Sonowal Manash Sonowal - 1 year ago 45
PHP Question

laravel 5.2 lists() method output different on server Issue with DB::lists method

return $local_places = DB::table('locals')->distinct('id')->lists('id');

Locally on Windows
it outputs [1] which is fine as should be but

in server running Ubunutu 14.04 it outputs ["1"] which is having double quotes and so my code is not working. Please help

Answer Source

I am assuming you are using mysql.

The problem must be with mysqlnd library. On the ubuntu server try this

$sudo dpkg -l | grep mysqlnd

If you do't get anything, it means you have missed the extension. You may install it like so

$sudo apt-get install php5-mysqlnd

(assuming you have php5)

mysqlnd is a native driver and it'll give you numbers as numbers and not string.