WEB Form output using mysql, search people name in specific category

Discussion in 'OT Technology' started by basketmen, Mar 23, 2008.

  1. basketmen

    basketmen New Member

    Joined:
    Jan 31, 2007
    Messages:
    119
    Likes Received:
    0
    I have search php forms that connecting to mysql, for search people name in all category and search people name in specific category

    People name field in mysql : people_name , example : John, Michael, etc
    category name field in mysql : people_category , example : Kid, Adult, etc


    I can Search All People name using first option value below, for example i search : John

    beside that i want to search : John only in adult category

    what is the right code so i can get people name just from adult category








    Please share your php mysql knowledge here
     
  2. rogueslg71

    rogueslg71 New Member

    Joined:
    Dec 31, 2007
    Messages:
    235
    Likes Received:
    0
    Location:
    Dallas, Tx / Friendswood, Tx
    search for all johns where people-category = adult ?
     
  3. basketmen

    basketmen New Member

    Joined:
    Jan 31, 2007
    Messages:
    119
    Likes Received:
    0
    yes you right, what is code i need to use in red line above???
     
  4. rogueslg71

    rogueslg71 New Member

    Joined:
    Dec 31, 2007
    Messages:
    235
    Likes Received:
    0
    Location:
    Dallas, Tx / Friendswood, Tx
    ? whatever you put in the red text above will not matter as long as you just add 'where people_catogory="adult"' at the end of your regular search mysql query when that option is selected
     
  5. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,767
    Likes Received:
    6
    i dont really know mysql but can it work like this...

    cant i just make an excel table, and somehow import it into phpmyadmin or some shit.

    then i can use your script to search through my columns/rows etc ?
     
  6. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,767
    Likes Received:
    6
    also i dont like to fuck artound with mysql cause im scared i fuck up and someone does a sql injection or w/e :o
     
  7. rogueslg71

    rogueslg71 New Member

    Joined:
    Dec 31, 2007
    Messages:
    235
    Likes Received:
    0
    Location:
    Dallas, Tx / Friendswood, Tx
    well yes you can import data from excel files, then you can use a script to search it , im not sure how to import the excel data but i searched 'import excel to phpmyadmin' and it came up with some answers.
     
  8. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,767
    Likes Received:
    6
    alright cause at work i usually use access to import some files.

    I'll probably have to save it as a CSV right ?

    well thanks i'll have to do some googling
     
  9. Vailripper

    Vailripper Daywalkers have feelings too.

    Joined:
    Jan 25, 2006
    Messages:
    6,170
    Likes Received:
    0
    Location:
    Bellingham, WA
    you will want to run SQL which searches for what you're looking for, it will look something like:

    SELECT * from <tablename> WHERE people_category = 'adult'
     
  10. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,767
    Likes Received:
    6
    im guessing you gotta connect to the database too right ? :o
     
  11. kingtoad

    kingtoad OT Supporter

    Joined:
    Sep 2, 2003
    Messages:
    55,923
    Likes Received:
    11
    Location:
    Los Angeles
    :hsugh: Can't query the database without a connection to it.
     
  12. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,767
    Likes Received:
    6
    yeah that's what i figured :o

    As i said, i am horrible with sql. Horrible as in, i dont know shit about it :o
     
  13. Vailripper

    Vailripper Daywalkers have feelings too.

    Joined:
    Jan 25, 2006
    Messages:
    6,170
    Likes Received:
    0
    Location:
    Bellingham, WA
    SQL is really very easy to learn, the only part that can be somewhat complicated is joins.
     
  14. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,767
    Likes Received:
    6
    im really eager to learn it, since it'd most likely lead me into a promotion at work, and help my future projects.

    I mainly learn from trial and error, but i'm a little worried since i've been hearing about sql injections, and am not sure how to avoid that happening to me... so i try to avoid learning sql :o
     
  15. rogueslg71

    rogueslg71 New Member

    Joined:
    Dec 31, 2007
    Messages:
    235
    Likes Received:
    0
    Location:
    Dallas, Tx / Friendswood, Tx
    might want to pick up this book called 'mysql phrasebook' i hve it and i think its a good type of book for trial and error people, its just snippets of code for different things you want to do with short explanations. its handy for most basic things you will want to do like searching
     

Share This Page