View Full Version : PHP/MySQL database search
January 30th, 2001, 18:30
Can anyone tell me the code to do a mySQL search using PHP please?
For example we could say that the field name is $keywords, the user would be able to type in some keywords, and get a list of documents relating to the search term.
PS, Iím very sorry if this is a basic task, but Iím still learning PHP :)
January 30th, 2001, 19:37
Parsing a list of keywords for a search engine type script will be too difficult for you if you don't know the basics...
January 30th, 2001, 20:11
mysql_query("SELECT id, site, url, description FROM table WHERE site LIKE '$keyword' OR description LIKE '$keyword' ORDER BY site ASC");
Visit http://www.php.net/mysql if you don't know how to get the data that will be returned.
January 31st, 2001, 09:20
Of course you have to parse the keyword list first... And querying with like on a text description is so inefficient - you'd want a script to go through the pages and pick out keywords, and normalize the database around those...
January 31st, 2001, 11:59
OK, this all look a tiny bit too complex for me at the moment, I think i'll worry about the rest of the site, learn a bit more, and than come back to this.
Thank you for your time, all of you :)
Powered by vBulletin® Version 4.1.7 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.