spluskhan Posted March 13, 2013 Share Posted March 13, 2013 hello all of you. i have database name Products id pr_name good poor faulty i need auto complete search that they suggest (pr_name) from my phpmyadmin database. this is my search code: <div id="wb_Form2" style="position:absolute;width:483px;height:112px;"> <form name="search" method="get" action="db1.php" id="Form2" onsubmit="return Validatesearch(this)"> <input type="text" id="Editbox8" style="position:absolute;left:11px;top:17px;width:456px;height:38px;line-height:38px;z-index:2;" name="query" value="" autocomplete="off" input type="text" name="query"> <input type="submit" id="Button3" name="" value="Add" style="position:absolute;left:192px;top:71px;width:96px;height:37px;z-index:3;"> </form> </div> and this is my search code: <html> <body> <head> <font size="3"><strong> <?php // Connects to your Database mysql_connect("host", "user", "pass") or die(mysql_error()); mysql_select_db("table") or die(mysql_error()); $q = mysql_real_escape_string($_GET['query']); $data = mysql_query("SELECT * FROM Products where name LIKE '%$q%'") or die(mysql_error()); while($info = mysql_fetch_array( $data )) { echo "Product Name: $info[name]<br>"; echo "Good Price: $info[good]<br>"; echo "Poor Price: $info[poor]<br>"; echo "Faculty Price: $info[faulty]<br><br>"; } ?> Link to comment https://forums.phpfreaks.com/topic/275583-auto-complete-search-from-database/ Share on other sites More sharing options...
spluskhan Posted March 13, 2013 Author Share Posted March 13, 2013 any 1 Link to comment https://forums.phpfreaks.com/topic/275583-auto-complete-search-from-database/#findComment-1418322 Share on other sites More sharing options...
timothyarden Posted March 13, 2013 Share Posted March 13, 2013 Here is a link to a similar thing you could use and manipulate the code from: http://w3schools.com/php/php_ajax_livesearch.asp Link to comment https://forums.phpfreaks.com/topic/275583-auto-complete-search-from-database/#findComment-1418329 Share on other sites More sharing options...
spluskhan Posted March 13, 2013 Author Share Posted March 13, 2013 its not helping . i need database suggesion Link to comment https://forums.phpfreaks.com/topic/275583-auto-complete-search-from-database/#findComment-1418347 Share on other sites More sharing options...
timothyarden Posted March 16, 2013 Share Posted March 16, 2013 Try combining some of the code from the previous link with this one: http://w3schools.com/php/php_ajax_database.asp - use the input from the first and cut out the xml and in the second one cut out the options and keep the stuff for the database and then manipulate it to your need Link to comment https://forums.phpfreaks.com/topic/275583-auto-complete-search-from-database/#findComment-1418946 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.