Originally Posted by sunfighter
But your problem is $gender in
$gender = mysql_result($result, 0);
is not a string, it's an array so
if($gender == '1' )
This isn't correct. mysql_result returns a string of the scoped column and row, never an array.
The problem is its highly unlikely you are pulling the correct data. Using a * pulls all records of a table user, which likely contains more than one field and highly improbable that the first one is the gender (although no rule exists specifying that an primary key is the first field, its typically the first field for simplicity). Either specify the correct field in the mysql_result, or modify the query to
SELECT gender FROM ...
The question of why are you querying for a known where value is valid though. There is no reason to query for a known value.
If you want to retrieve all records within a row, use mysql_fetch_assoc or mysql_fetch_row. If there are multiple iterations use a while loop. Never use mysql_result for multiple fields or rows as its very slow.
So the question really is what are you looking for? The query tells me you want to find any user that is male or female as specified in $_GET[gender] (which should be using
'" . $_GET['gender'] . "'
btw), in which case you are intending to pull multiple records from a resultset. For this you must loop.