Ok, ignore the incoherent mumblings about passing by reference... I've found a hack
This should be about right (it's late you might need to make minor adjustments but I've run tons of experiments and stuff before putting this together):
PHP Code:
class BindParam{
private $values = array(), $types = '';
public function add($type, $value ){
$this->values[] = $value;
$this->types .= $type;
}
public function get(){
$Result = array_merge(array($this->types), $this->values);
//Hack for dealing with pass by reference crap
foreach($Result as $Key => &$Value)
{
$Refs[$Key] = &$Value;
}
return $Refs;
}
}
$bindParam = new BindParam();
//First parameter is member_id from session
$bindParam->add('i', $sessMemberID);
foreach($_POST['msgArray'] as $msgID => $msgValue){
$Count += 1;
$bindParam->add('i', $msgID);
$IDs[] = "message_id=?";
}
$MessageIDs = implode(' or ', $IDs);
// Build query.
$q1 = "UPDATE private_msg_recipient SET read_on=NULL, updated_on=NOW() WHERE member_id_to=? AND ($MessageIDs) LIMIT $Count";
//UPDATE private_msg_recipient SET read_on=NULL, updated_on=NOW() WHERE member_id_to=? AND (message_id=? or message_id=? or message_id=?) LIMIT 3
// Prepare statement.
$stmt1 = mysqli_prepare($dbc, $q1);
// Bind variables to query.
call_user_func_array(array($stmt1, 'bind_param'), $bindParam->get());
// Execute query.
mysqli_stmt_execute($stmt1);
// Verify Update.
if (mysqli_stmt_affected_rows($stmt1)==1){
// Update Succeeded.
$redirectView = 'incoming';
}else{
// Update Failed.
}
Good night, god bless and Merry Christmas