Justafriend Posted October 20, 2014 Share Posted October 20, 2014 Ok i have seen many solutions for using a search function to post onto webpage directly from the mysql db but my question is is there a way to seach the results that were already outputted via a php query, for instance i have a query that returns 1 MisFit_Kay1 811 2 sajoma 806 3 Atlfan 708 4 karlsbad70 633 5 Booo 570 6 MisFit_Mimi_shg 541 7 PRO_Viking 540 8 tm7_cryzal 540 9 TM7__mina 499 10 PRO_DRFRANK 488 11 PRO_FLAK 488 12 Mhoram 464 13 TM7__CEDAR 462 14 ProSultan 456 15 UBG_Steely1 450 but with lots more results now what im hoping for is a point in a direction where i could add a search box that will highlight the name from the list provided . any help will be appreciated Link to comment https://forums.phpfreaks.com/topic/291940-search-function/ Share on other sites More sharing options...
QuickOldCar Posted October 20, 2014 Share Posted October 20, 2014 Sure you can use preg_match_all() on those results and it creates a new array.. It would be better to do the proper search queries though and not have all the extra data. Link to comment https://forums.phpfreaks.com/topic/291940-search-function/#findComment-1494220 Share on other sites More sharing options...
QuickOldCar Posted October 20, 2014 Share Posted October 20, 2014 Actually if are doing this in a loop from mysql results use preg_match() If it matches either echo the results or save into a new array to output after the loop. Still recommend doing a normal search either with LIKE or use fulltext boolean mode Link to comment https://forums.phpfreaks.com/topic/291940-search-function/#findComment-1494221 Share on other sites More sharing options...
Justafriend Posted October 20, 2014 Author Share Posted October 20, 2014 thhe iossue is that i have specific totals each points is a new entry the query that gives that list is an addition of all same entries between 2 dates why i was hoping to do it so that it wouuld just search the current list i have to give ypou a better idea of what i mean here is my php coding <?php $db = mysql_connect("localhost", "happyga1_points","Smkn4life"); mysql_select_db("happyga1_points",$db); $i = 0; $d = date("2014-10-01"); //$d = preg_replace("/-(\d+) /", "-01 ", $d); // echo("Extracting data since $d<br/>"); $r = mysql_query("select playername, sum(Points) as total from points where timestamp > '$d' Group by playername order by total DESC") or trigger_error(mysql_error()); while ($v = mysql_fetch_assoc($r)) { ++$i; echo("<tr><td>$i</td><td>${v["playername"]}</td><td>${v["total"]}</td></tr>\n"); } ?> Link to comment https://forums.phpfreaks.com/topic/291940-search-function/#findComment-1494269 Share on other sites More sharing options...
Ch0cu3r Posted October 20, 2014 Share Posted October 20, 2014 So you are wanting display a table of results. And then you'd have a textbox where the user can type in a username to filter the results by? Ie you type in PRO_Viking and it'll only show their results? Link to comment https://forums.phpfreaks.com/topic/291940-search-function/#findComment-1494274 Share on other sites More sharing options...
Justafriend Posted October 20, 2014 Author Share Posted October 20, 2014 yes exactly Link to comment https://forums.phpfreaks.com/topic/291940-search-function/#findComment-1494285 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.