Hey guys, I need a little help.
I'm not just a php newb, I'm php illiterate -- don't know a lick of it. None the less, that hasn't stopped my from attempting some hacks on a new php application I just bought.
I'm proud that a few even work LOL.
This is going to be a long explaination for what is, I'm sure, a short fix, but I want to explain fully:
This is what's throwing me:
PHP Code:
if($search_gender != "")
{ if ($search_looking_for != "" && $search_looking_for != "Any")
{
$sql_where = "p.looking_for='$search_gender' and p.gender='$search_looking_for' "; $nWas = 1;
}
}
else if($search_looking_for != "" && $search_looking_for == "Any")
{
$nWas = 0;
}
else
{
$sql_where = "p.looking_for='$search_gender' ";
$nWas = 1; }
This is from a dating application.
When a member fills out a profile, they have to list which gender they're looking for, but the program forces the person to choose only 1 gender in their profile that they're searching for. This becomes = "p.looking_for"
Then, you're allowed to seach by inputting your gender ($search_gender) and the gender you're currently looking for ($search_looking_for).
The code is to search the profiles, matching men looking for women with women looking for men. It also allows either gender to search for "any" profile regardless of what the searched profile says they're looking for.
I'd like the script to not only allow men to search "women" or "any"; and women to search for "men" or "any", I'd like members to be able to choose "Looking for any" in their profile (instead of being forced to select 1 gender as it is now) and then have the search function above match "looking for any" with "men" AND "women".
The best way I can explain this is to note the difference between 1) a man looking for "any" and 2) "any" looking for a "man".
I THINK that all I have to do is add one line immediately after the very first "if($search_gender != "")". I also THINK that that line would probably be
PHP Code:
if($search_looking_for != "" && p.looking_for == "Any")
{
$nWas = 0;
}
else
Does that look correct?
Feel free to ask me any other info you need. Thanks ahead of time for any direction (besides the obvious: learn PHP, LOL).
Mark