Jump to content

Searching in data base


yanivkalfa

Recommended Posts

Anywyas . i am trying to search from my data base something that the user sent with form its simple search

though its nothing preset i mean i need to search from a table and i dont want  to search the exact word.

for EG the dude typed in

metalica ban and in my database is shows as metalica

i want a quary that will search for the most close resualt that it can

i can use

$query  = "SELECT * FROM files LIMIT $limitvalue, $limit WHERE name = '$_POST[search]'";

 

i mean this is do able but if the dude have written metalica ban and in my intery i have metalica only will it still choose metalica ?

 

well if it wont will someone please show me a better way of doing so .  would realy help me . thanks in advanced

 

 

BTW i have no idea why it brought up this poll.

Link to comment
Share on other sites

Even with the above, if a user were to enter 'metalica ban' the query would not find rows matching 'metalica'. One way around this is to explode the search term by the space, and search the database to see if any of the words match.

 

However, that would then lead you into issues of relevant results. You may wish to look into full text searching.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.