i have mysqli
query returns multidimensional array
.
i'm trying encode php array:
array(3) { [0]=> array(8) { ["cod_evento"]=> string(1) "3" ["titulo"]=> string(20) "fiesta de cumpleaƱos" ["descripcion"]=> string(23) "mi fiesta de cumpleaƱos" ["puntuacion"]=> string(1) "1" ["direccion"]=> string(13) "c/ falsa 1234" ["imagen"]=> string(115) "http://static.guim.co.uk/sys-images/guardian/pix/pictures/2014/4/11/1397210130748/spring-lamb.-image-shot-2-011.jpg" ["fecha"]=> string(19) "2015-01-01 00:00:00" ["cod_usuario"]=> string(1) "1" } [....] }
but when try json_encode($array)
returns bool(false)
when try encode array(2) or (1), works.
from docs
http://php.net/manual/en/function.json-encode.php
returns json encoded string on success or false on failure.
to see reason of failure
http://php.net/manual/en/function.json-last-error-msg.php
to answer question in comments
Comments
Post a Comment