jkewlo Posted April 15, 2009 Share Posted April 15, 2009 Hey everyone I am trying to make a function that will show the post of other users that a user is following etc... well I am getting this error Warning: implode() [function.implode]: Bad arguments. in /Data/Function.php on line 54 This here is the Function I will Comment out the line that is throwing the Warning. If you could please help me with this this would be cool thanks alot function show_posts($userid,$limit=0){ $posts = array(); // $user_string = implode(',', $userid); $extra = " and id in ($user_string)"; if ($limit > 0){ $extra = "limit $limit"; }else{ $extra = ''; } $sql = "SELECT posts.body, posts.stamp, posts.user_id, users.id, users.username FROM posts inner join users on posts.user_id = users.id WHERE users.username='". $_SESSION['myusername'] ."'order by stamp desc"; $result = mysql_query($sql); while($data = mysql_fetch_object($result)){ $posts[] = array( 'stamp' => $data->stamp, 'userid' => $data->user_id, 'body' => $data->body ); } return $posts; } Quote Link to comment Share on other sites More sharing options...
taquitosensei Posted April 15, 2009 Share Posted April 15, 2009 $userid is probably not an array. if(is_array($userid)) { $user_string = implode(',', $userid); } else { //do whatever you'd do if $userid isn't an array } Quote Link to comment Share on other sites More sharing options...
mrMarcus Posted April 15, 2009 Share Posted April 15, 2009 is $userid an array? Quote Link to comment Share on other sites More sharing options...
jkewlo Posted April 15, 2009 Author Share Posted April 15, 2009 no, I was reading a Tutorial Working my way threw it. My array Skill's are not the best >< Quote Link to comment Share on other sites More sharing options...
jkewlo Posted April 15, 2009 Author Share Posted April 15, 2009 Thanks alot Problem Solved Quote Link to comment 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.