View Full Version : PHP Search Engine
albert
08-24-2002, 05:20 PM
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
mordred
08-24-2002, 05:52 PM
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:
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.
Spookster
08-24-2002, 05:58 PM
:thumbsup: Moving it now...
albert
08-24-2002, 07:34 PM
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
albert
09-04-2002, 03:26 PM
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
mordred
09-04-2002, 09:48 PM
Do I miss the most important part: Where's the question? :confused:
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. ;)
albert
09-05-2002, 11:46 AM
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
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.