DarkHavn Posted September 2, 2006 Share Posted September 2, 2006 Hey what i'm trying to do is search the database using the value the user inputs in the search feild that is in PHP.currently i'm taking the values from this input='text' feild (the user types in keywords) and connecting to the database and running[quote]//$keywords contains the value form the search feild$sql = "SELECT * FROM catalogue WHERE `keywords`='$keywords'";[/quote]now in the database, the user can upload up to 200 keywords to a each photo they upload, but for some odd reason, the keywords im testing with match in the database but no results are being returned???is there a quicker mysql string i can use? Quote Link to comment Share on other sites More sharing options...
fenway Posted September 2, 2006 Share Posted September 2, 2006 Try using LIKE with % wildcards. Quote Link to comment Share on other sites More sharing options...
Craigypoos Posted September 5, 2006 Share Posted September 5, 2006 [quote author=fenway link=topic=106620.msg426569#msg426569 date=1157212260]Try using LIKE with % wildcards.[/quote]How, exactly?I've been having the same problem. I have a database full of motorbike parts and I want to be able to search the entire database for a search string such as "clutch" to retrieve all the clutch related parts from my database (ie clutch levers, clutch cables, etc etc)...I've tried various different variations using LIKE and % and just can't seem to get it to work. I've even tried using MATCH....AGAINST, but to no avail. Could you give an example of the code syntax?Cheers,Craigypoos Quote Link to comment Share on other sites More sharing options...
fenway Posted September 5, 2006 Share Posted September 5, 2006 Well, field LIKE '%clutch%' is definitely going to work... it's just a question of how efficient this is. Quote Link to comment Share on other sites More sharing options...
Craigypoos Posted September 5, 2006 Share Posted September 5, 2006 Thanks for your reply.However, I seem to have a MATCH AGAINST clause thing going on now, and it works lovely...except, some of the words used to search for will be the names of bikes (such as CBR or GSXR) so the 4 letter lower limit kicks in. It's late now, but I reckon tomorrow I'll try it the LIKE way or write a php IF thingy to choose whether to do the query IN BOOLEAN MODE or not....Thanks anyway for your (very prompt) help.Craigypoos Quote Link to comment Share on other sites More sharing options...
fenway Posted September 6, 2006 Share Posted September 6, 2006 Or you can roll-your-own index column. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.