Jump to content

HELP NEEDED WITH SEARCH.....very simple!!


raryre23

Recommended Posts

i downloaded a script for my website which amoungst other things allows users to search for members of the website. however i am intending to use this search as a search for horses instead and so i need to change the script so that instead of looking in the database for M or F (gender of people), it instead looks for S, G or F (the different genders of horses). Im sure it is fairly simple and probably the most basic PHP - i just dont ahve a clue when it comes to PHP! im guessing something here should be changed:

 

$sheading="Search Results";

$lextra="&listpics=$listpics&gender=$gender&age1=$age1&age2=$age2";

if($listpics=="Y")

{

$sql="select distinct(members.username) from members,photos where members.username=photos.username and approved='Y' and age>=$age1 and age<=$age2 and active=1";

}

else

{

$sql="select distinct(members.username) from members where age>=$age1 and age<=$age2  and active=1";

}

if($gender=="M")

{

$sql=$sql." and gender='M'";

}

else if($gender=="F")

{

$sql=$sql." and gender='F'";

 

 

any help would be appreciated... thanks

Link to comment
https://forums.phpfreaks.com/topic/46860-help-needed-with-searchvery-simple/
Share on other sites

change this part

<?php
if($gender=="M")
   {
      $sql=$sql." and gender='M'";
   }
   else if($gender=="F")
   {
      $sql=$sql." and gender='F'";
   }
?>

 

to

 

<?php
if($gender=="S")
   {
      $sql=$sql." and gender='S'";
   }
   else if($gender=="G")
   {
      $sql=$sql." and gender='G'";
   }
   else if($gender=="F")
   {
     $sql=$sql." and gender='F'";
   }
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.