I have two MySQL tables. One is called members
and has a column called users
. The other is called sex
and has two columns: user_s
and sex
.
I am trying to create an array comprised of all users from the members table who are
1) in the sex table and 2) have "men" selected in the sex column.
When I print_r
this array nothing is displayed even though I can see that there are users who met these criteria. Any thoughts?
<?php
// test.php
include_once("header.php");
$iaminterestedin = "men";
$result = queryMysql("SELECT `user` FROM `members`
WHERE `user` IN(SELECT `user_s` FROM `sex` WHERE sex='$iaminterestedin')");
$combination = array();
while(($row = mysql_fetch_assoc($result)))
{
$combination = $row['user'];
}
print_r($combination);
?>