felito Posted October 31, 2011 Share Posted October 31, 2011 hi i have this code: //sql $sql -> bind_param('s',$offer); $sql -> execute(); $sql -> bind_result($oferta, $cargo, $conteudo, $tipo_oferta, $local); $arr = array(); while ($sql -> fetch()) { $arr[] = array($oferta, $cargo, $conteudo, $tipo_oferta, $local); }; return $arr; then i make this in ajax (jquery) data: 'all=<?php echo json_encode($arr); ?>', and in other page i make: $editar = $_POST['all']; $e = json_decode($editar, true); echo $e[0][0]; the problem is: if i only do : $arr[] = array($oferta); this echo $e[0][0]; outputs: designer (is the value of $oferta) but if i do $arr[] = array($oferta, $cargo, $conteudo, $tipo_oferta, $local); echo $e[0][0]; simply doesn't show anything. the question is why ? and how can be solved? Quote Link to comment https://forums.phpfreaks.com/topic/250166-problem-with-array-and-json_encode-decode/ Share on other sites More sharing options...
felito Posted October 31, 2011 Author Share Posted October 31, 2011 i change to php 5.3 and the problem disappear Quote Link to comment https://forums.phpfreaks.com/topic/250166-problem-with-array-and-json_encode-decode/#findComment-1283742 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.