php - Invalid argument supplied for foreach() in web service API -


i'm using php code call json api, i'm having issues loading.

php code

                $response[$i]['id']=$datafriend[$i]['id'];                 $response[$i]['name']=$datafriend[$i]['name'];                 $response[$i]['id']=$id;                 $response[$i]['lastmsgfrom']=$msg_from;                 $response[$i]['lastmsgtype']=$type;                 $response[$i]['lastmsg']=$msg;                 $response[$i]['lastmsgtime']=$time;                 $response[$i]['lastseen']=$datafriend[$i]['date'];                 $response[$i]['status']=$datafriend[$i]['status'];             }         }         foreach ($response $key => $row) {             $volume[$key]  = $row['lastmsgtime'];         }         array_multisort($volume, sort_desc, $response);         array_unshift($response, $userdata); 

error log

php warning:  invalid argument supplied foreach() php warning:  array_multisort(): argument #1 expected array or sort flag php warning:  array_unshift() expects parameter 1 array, null given php warning:  invalid argument supplied foreach()  php warning:  array_multisort(): argument #1 expected array or sort flag php warning:  array_unshift() expects parameter 1 array, null given 

i appreciate ideas?


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -