On Fri, Oct 25, 2013 at 5:27 PM, Stephen <stephen-d@xxxxxxxxxx> wrote: > The warning is from this code: > > if ( in_array( $keys, $photo_ids ) ) > > *Warning*: in_array() expects parameter 2 to be array, null given in > */home/rois3324/include/**cpprocessforms.php* on line *203* > This happens when you allow PHP to create the array for you. Before iterating through another (possibly empty) array and adding photo IDs to $photo_ids, you must assign an empty array to the variable. You need to add $photo_ids = array(); at the top of the function. PHP will happily assign a new array to $photo_ids if the variable is null in this loop: while ( list( $id ) = $stmt->fetch(PDO::FETCH_NUM)) { > $photo_ids[] = $id; > } But if that statement produces an empty result set, $photo_ids will remain null. Cheers, David