// NOT IMPORTANT,Just getting the ages dates...
$from_year_to_search = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d"), date("Y")-$from));
$to_year_to_search = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d"), date("Y")-$to-1));
$to_year_to_search = date("Y-m-d",strtotime(date("Y-m-d", strtotime($to_year_to_search)) . " -1 day"));
// this is the search which gets a random rows
$result = mysql_query("SELECT * FROM `profiles` WHERE id != '".$my_profile->GetID()."' AND sex = '".$thesex."' AND id NOT IN (SELECT user_id_was_interested_in FROM
InterestedList WHERE user_id_choose='".$my_profile->GetID()."') AND birthday BETWEEN '".$to_year_to_search."' AND '".$from_year_to_search."' ") or die(mysql_error());
$found = mysql_num_rows($result);
if ($found > 0)
{
$flag_place = rand(0, $found-1);
$result2 = mysql_query("SELECT * FROM `profiles` WHERE id != '".$my_profile->GetID()."' AND sex = '".$thesex."' AND id NOT IN (SELECT user_id_was_interested_in FROM
InterestedList WHERE user_id_choose='".$my_profile->GetID()."') AND birthday BETWEEN '".$to_year_to_search."' AND '".$from_year_to_search."' LIMIT $flag_place,1") or die(mysql_error());
}
Bookmarks