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; } Link to comment https://forums.phpfreaks.com/topic/154217-solved-warning-implode-functionimplode/ 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 } Link to comment https://forums.phpfreaks.com/topic/154217-solved-warning-implode-functionimplode/#findComment-810753 Share on other sites More sharing options...
mrMarcus Posted April 15, 2009 Share Posted April 15, 2009 is $userid an array? Link to comment https://forums.phpfreaks.com/topic/154217-solved-warning-implode-functionimplode/#findComment-810754 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 >< Link to comment https://forums.phpfreaks.com/topic/154217-solved-warning-implode-functionimplode/#findComment-810755 Share on other sites More sharing options...
jkewlo Posted April 15, 2009 Author Share Posted April 15, 2009 Thanks alot Problem Solved Link to comment https://forums.phpfreaks.com/topic/154217-solved-warning-implode-functionimplode/#findComment-810765 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.