Jump to content

Better searching?


3raser

Recommended Posts

$keywords = $_POST['keywords'];

//protection
$before = array('(', ')', '^', '<', '>', '`', '*', '<script>', '</script>', ';DROP TABLE users;', 'users', 'DROP', 'TABLE');
$after   = array('', '', '', '', '', '', '', '', '', '', '', '', '');
$output  = str_replace($before, $after, $keywords);


//display data
$get = mysql_query("SELECT * FROM items WHERE keywords='$keywords'");
while ($row = mysql_fetch_assoc($get))

 

That only makes it get items that are the EXACT NAME. But how do I get it so it uses the keywords in the database? Like their is an Item named Pixel, you search pix and it doesn't work. But if you do Pixel, it will. :/

Link to comment
https://forums.phpfreaks.com/topic/191299-better-searching/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.