While loop does not print selected names from db

I have this code with my pagination and it is produces all the names in the db. I would like it to produce the names of the looking_for from the username gender. Can anyone tell me where I am going wrong.


// VALIDATE THE VALUE, SANITIZE AND ASSIGN IF VALID
$valid = array( 'Male', 'Female');
if( in_array($_POST['looking_for'],$valid) ) {
     $looking_for = mysql_real_escape_string($_POST['looking_for']);	} else {  
  	 // an invalid value was submitted, so throw an error, or whatever.	 
}
// DEAFAULT QUERY STRING
$queryString = "WHERE gender= '$looking_for' ORDER BY looking_for ASC";

// DEFAULT MESSAGE ON TOP OF RESULT DISPLAY

$queryMsg = "Showing looking_for";
$sql = mysql_query("SELECT * FROM Members ORDER BY gender = '$looking_for'");

$nr = mysql_num_rows($sql);

$sql2 = mysql_query("SELECT * FROM Members ORDER BY gender = '$looking_for' LIMIT $pn, $itemsPerPage");

$outputList = '';
while($row = mysql_fetch_array($sql2)) {
 	$id = $row["id"];
	$gender = $row["gender"];
	$looking_for=$row["looking_for"];
	$firstname = $row["firstname"];	
if (!$firstname) {	
	$firstname = $username;	
}

Currently your MySQL query is 100% invalid, when using MySQL queries you need to check rows against values using the WHERE statement as ORDER BY is simply for column ordering. Simply change

ORDER BY gender = '$looking_for'

to

WHERE gender = '$looking_for' ORDER BY gender DESC

Also when using MySQL queries its best to add error catching as well as it helps to debug issues like this, see the example below.

if (!$sql = mysql_query("SELECT * FROM Members WHERE gender = '$looking_for' ORDER BY gender DESC")) {
    die('MySQL Error: ' . mysql_error());
}