Jump to content

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

Edited by Justafriend
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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.