sharpshoot3r Posted February 10, 2007 Share Posted February 10, 2007 Hello everyone ! I need Database search engine script. From where i can get free search script ? I found one but its file search. Help me please. Thanks in advice! sharpshoot3r Link to comment https://forums.phpfreaks.com/topic/37936-database-search-engine/ Share on other sites More sharing options...
giba Posted February 10, 2007 Share Posted February 10, 2007 Hey, brother I will remember you that google or other search engine is quite another thing. I will give you a simple but good search engine system: Make this as a test, later modify this increasing columns, adding contents to them, feel free as you need. To seach dinamically we need a form (SAVE THIS AS "search_form.html"): <HTML> <HEAD> <TITLE>Search Engine</TITLE> </HEAD> <BODY> <form method="POST" action="search.php"> Word: <input type="text" size="80" name="word"><br /> <input type="submit" value="Search"> </form> </BODY> </HTML> Now the script: (SAVE THIS AS "search.php" it's the action!): First create a database (if you have a one use this) Create the table "news" Create three field: "code", "title" and "news" <?php if(!empty($_POST['word'])) { $word = str_replace(" ", "%", $_POST['word']); // Alter the spaces adding a % symbol mysql_connect('yourserver','user','password'); mysql_select_db('yourdatabase'); $query = "SELECT * FROM news WHERE news LIKE '%".$word."%' ORDER BY code DESC"; $sql = mysql_query($query); // Executes the query in the database $total = mysql_num_rows($sql); // Counts the total of results found echo "Your search returned: <strong>'$total'</strong> result(s). "; while($result = mysql_fetch_array($sql)) { // Creates the Loop with the results echo " "; echo "<em><font color=\"blue\">".$result['news']."</em></font>"; } } ?> I hope I could help! Link to comment https://forums.phpfreaks.com/topic/37936-database-search-engine/#findComment-181613 Share on other sites More sharing options...
giba Posted February 10, 2007 Share Posted February 10, 2007 I remember you that you must include contents to your database manually or create a way to do that by form. Link to comment https://forums.phpfreaks.com/topic/37936-database-search-engine/#findComment-181615 Share on other sites More sharing options...
utexas_pjm Posted February 10, 2007 Share Posted February 10, 2007 I'd suggest having a look at Lucene. It's a port from Java and is integrated into the Zend Framework: http://devzone.zend.com/node/view/id/91. Best, Patrick Link to comment https://forums.phpfreaks.com/topic/37936-database-search-engine/#findComment-181617 Share on other sites More sharing options...
sharpshoot3r Posted February 13, 2007 Author Share Posted February 13, 2007 Man look at there $total = 30($sql); // Counts the total of results found and look there Parse error: parse error, unexpected '(' in /home/hosting/lineageii/web/search.php on line 11 Where is the problem? And what means that I remember you that you must include contents to your database manually or create a way to do that by form. Thanks in advince Link to comment https://forums.phpfreaks.com/topic/37936-database-search-engine/#findComment-183707 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.