Jump to content

search function


Justafriend

Recommended Posts

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

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

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

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.