Hi all,
First post and all that, so hello!
I have been stuck with this issue for hours and would really appreciate some help.
Basically, I am trying to retrieve a list of events made by a users friends. The code detailed below may help explain it a bit better.
//we have our friends in an array
$friends = array('test@test','more@tests','even@more');
//function to get events from our friends
function getEvents( $friends )
{
global $mysqli; //include mysqli object
$status = 1; //1 means friend is confirmed
$q = array_fill(0,count($friends),'?');
$param = implode(',',$q); //create x ?'s for our prepare statement
$sql = "SELECT id,email,date,event FROM events WHERE email IN ({$param}) ORDER BY id DESC LIMIT 30";
if ($stmt = $mysqli->prepare($sql))
{
call_user_func_array(array($stmt, 'bind_param'), $friends);
$stmt->execute();
$stmt->bind_result($gid,$gEmail,$gDate,$gEvent);
while($stmt->fetch())
{
//loop and display events from our friends
}
}
}
But what outputs is
Warning: Parameter 2 to mysqli_stmt::bind_param() expected to be a reference, value given in C:\code\php\site\default.php on line 309
To give you more of an idea, Line 309 is
call_user_func_array(array($stmt, 'bind_param'), $friends);
Can someone please help me? Thanks in advance!
Brad