Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PHP Search Engine

    Hello

    I need help with a PHP / MySQL script l am trying to develop. The idea is l want the script to be able to search two fields within my database match the two fields and display the result from the third field

    ie:

    search box one they enter : Music

    search box two they enter : USA

    we want the script to search the database match the two queries
    and give a result from a third field

    ie:

    Music USA = OHIO

    Please if anybody can help

    albertpeach@mediawerks.co.uk

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Obviously you missed to read the very first "must read" message in this forum, for it says already in the subject: " Post questions involving MySQl/SQl in the MySQL forum". Please read "must read" threads, thanks. Moderators, this post should be moved.

    I'm not quite sure where your problem lies. I *suspect* it's the SQL query, but if it's rather the PHP script you are developing, you better post the code you have made up until now so we can have a look at it.
    Anyway, if you want to retrieve the value of a third field in a row in which two other fields match the search keywords, then this might help you:

    Code:
    SELECT
        fieldname3
    FROM
        tablename
    WHERE
        fieldname1 = $keyword1
        AND fieldname2 = $keyword2
    This assumes that the search keywords are stored in PHP variables called $keyword1 & $keyword2. If you want a more fuzzy search, try the LIKE or REGEXP keyword. Or consider doing a MATCH against a fulltext-indexed field.

  • #3
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,273
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Moving it now...
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #4
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Mordred

    Hello Mordred

    Thank you for the quick reply, l apologise for the error regarding the post, it won't happen again

    As for the script l will include it with this post. I will also try the method you posted and will let you know the out come.

    The idea of the script is that it take the queries from the two search fields passes them on to a PHP script then gives the user the result from the third field from which matches field one and two.

    Also we want the result to be a link to a separate page. Any advice you could give would be greatly appreciated

    Once again Thanks

    Albert
    Attached Files Attached Files

  • #5
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PHP Search Engine

    Hi Mordred,

    First of all I would like to thank you for all your help to date.

    I have included as much information I can think of to give you a complete picture as to the required functions of our PHP script. If there is anything else you need please ask i will quickly provide it to you.

    Thanks again

    Albert
    Attached Files Attached Files

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Do I miss the most important part: Where's the question?

    Does your PHP environment allow for mysql_pconnect and have you register_globals = on, because these were the only points I could think of being critical... but it's up to you to provide us with a decent problem/error description. And "does not work" is *not* a decent description.

  • #7
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Hi Mordred

    We have now decided to delete the script altogether as it is far to time consuming.

    The idea is we want a to add a search engine to our existing web site. It has to be able to search for a category and postcode together the return a result that matches the two queries.

    If you would like to see an example of what we are after visit

    www.scoot.co.uk

    This search engine would be exactly to our requirements.If you can help with this matter it would be greatly appreciated.

    Regards

    Albert


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •