View Single Post
Old 01-05-2013, 10:31 AM   PM User | #2
AndrewGSW
Senior Coder

 
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
AndrewGSW will become famous soon enough
Maybe something like..

PHP Code:
if (isset($messagesToUpdate) && $messagesToUpdate) {  
        
// Update Selected Messages. 
    
$parmcount count($messagesToUpdate);
    
$inclause implode(','array_fill(0$parmcount'?')); // = ?,?,?,?
    // Build query. 
            
$q1 "UPDATE private_msg_recipient 
                    SET read_on = NULL, 
                        updated_on = NOW() 
                    WHERE member_id_to = ? 
                    AND message_id IN (%s)"
;

    
$preparesql sprintf($q1$inclause);
    
// Prepare statement. 
    
$stmt1 mysqli_prepare($dbc$preparesql); 

    
array_unshift($messagesToUpdate$sessMemberID);

    
$type 'i' str_repeat('i'$parmcount);
    
// Bind variables to query.
    
call_user_func_array('mysqli_stmt_bind_param'
        
array_merge(array($stmt1$type), $messagesToUpdate)); 
    
// Execute query. 
    
mysqli_stmt_execute($stmt1);
    
    
// Verify Update. 
    
if (mysqli_stmt_affected_rows($stmt1) == 1) { 
        
// Update Succeeded. 

    
} else { 
        
// Update Failed. 
    

__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS
AndrewGSW is offline   Reply With Quote