I was wondering if anyone has a php script for a search box.
I have the search box but i do not have the script behind that so people can search my website.
I would be grateful if someone has one and they can let me know, or where to find one.
Well, I think the most easy way to do it is go searching in your database. So you get something like this:
$key = addslashes($_POST['key']); //get the variable out of the searchfield and protect it with addslashes() against sql-injections
$query = mysql_query("SELECT * FROM `articles` WHERE `content` LIKE '%$key%';
I didn’t script for a while and didn’t test this, but I think this is the way how to do it…
You must be logged in to reply to this topic.
*May or may not contain any actual "CSS" or "Tricks".