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
https://forums.phpfreaks.com/topic/154217-solved-warning-implode-functionimplode/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.