Jump to content

[SOLVED] Warning: implode() [function.implode]


jkewlo

Recommended Posts

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.