Hi, I managed to get this working fine but i totally forgot that i would need to add pagination into the page so i have had to edit this slightly. Now i have it gives back a 5 for every match, Any Ideas? $dataCollection = array(); $getData = mysql_query("SELECT * FROM users WHERE $stored AND status='active' ORDER BY id DESC"); $countrows = mysql_num_rows($getData); $result = array(); $resultsi = mysql_query("SELECT * FROM users WHERE id = '$_COOKIE[id]'"); $rowi = mysql_fetch_array($resultsi); // Use the result $qualities = array( 'charming', 'sense_of_humour', 'loyal', 'honest', 'attractive', 'optimistical', 'realistic', 'sexy', 'ambitious', 'visionary', 'quiet', 'conservative', 'tolerant', 'curious', 'selfconfident', 'athletic', 'attentive', 'shy', 'sociable', 'dominant', 'creative', 'active', 'passive', 'omesticated', 'friendly', 'sympathetic', 'fond_of_children', 'fond_of_animals', 'intelligent', 'romantic', 'talkative', 'joyful', 'humble', 'modest', 'caring', 'respectful', 'generous', 'thoughtful', 'down_to_earth', 'sensitive', 'professional', 'business_minded', 'solvent', 'determined', 'successful' ); while ($r=mysql_fetch_array($getData)) { $i = 0; foreach ($qualities as $quality) { if ($rowi['partner_'.$quality] == '1' && $r[$quality] == '1') $i++; } // Get results from the database if ($rowData = mysql_fetch_assoc($getData)) { do { $dataCollection[] = $rowData; } while($rowData = mysql_fetch_assoc($getData)); } $smarty->assign('match', $i); array_push($result, $dataCollection); } // Assign the results to an array $pagination = new pagination(); $dataPages = $pagination->generate($dataCollection, 10); $smarty->assign('listing', $dataPages); $smarty->assign('pagination', $pagination->links()); $smarty->assign('countrows', $countrows); PHP: Cheers, Adam