Jump to content

[SOLVED] Search function navigation help


djtozz

Recommended Posts

Hello,

 

I'm having some probs with the page navigation from http://www.filemirrors.info/new

The navigation works, but when selecting certain file host or file type the navigation doesn't works properly:

 

Search example:

When searching for 'dvdrip' and selecting ONLY avi files

http://www.filemirrors.info/new/index.php?q=dvdrip&type=all&tmedia=avi&search=Search

 

I'm getting the right results but the option 'avi' is not saved/included in the navigation.

Page 2 displays all mediatypes.

 

 

 

 

 

     

// Options selection box select host & type
$stype=" AND `fsize`<>''";
if($_GET['stype']=='checked') $stype=" AND `fsize`<>''";

if(!isset($_GET['type']) || $_GET['type']=="all") $fxtype="";
else
{
	if($_GET['type']>=1 && $_GET['type']<=12) $fxtype="AND type='".$_GET['type']."'";
	else $fxtype="";
}

if(!isset($_GET['tmedia']) || $_GET['tmedia']=="all") $fxmedia="";
else
{
	if($_GET['tmedia']=='avi') $fxmedia="AND media='avi'";
	if($_GET['tmedia']=='mp3') $fxmedia="AND media='mp3'";
	if($_GET['tmedia']=='rar') $fxmedia="AND media='rar'";
	if($_GET['tmedia']=='zip') $fxmedia="AND media='zip'";
}
// end options



$kwd=mysql_real_escape_string($_GET['q']);
$info['keyword']=$kwd;
$info['total_results_count']=mysql_get_first_result("SELECT COUNT(*) FROM `v2links` WHERE  MATCH (caption) AGAINST ('$kwd')$stype $fxtype");

// navigation
if($_GET['start'] && is_numeric($_GET['start']))
{
	$start=$_GET['start'];
	$start=((int)($start/$search_count))*$search_count;
}
else $start=0;
$info['curpage']=ceil(($start+1)/$search_count);
$info['total_pages']=ceil($info['total_results_count']/$search_count);
$navigation=array();
$navigation[]='<span class="navi navi_current"> -'.$info['curpage'].'- </span>'."\n";
$inc=$dec=$start;
$tcnt=0;
for($i=0;$i<9;$i++)
{
	$inc+=$search_count;
	$incp=ceil(($inc+1)/$search_count);
	$dec-=$search_count;
	$decp=ceil(($dec+1)/$search_count);
	if($inc<$info['total_results_count'])
	{
		array_push($navigation,'<span class="navi"> <a href="./?q='.$_GET['q'].'&start='.$inc.'"&type='.$_GET['type'].'>'.$incp.'</a> </span> '."\n");
		$tcnt++;
	}
	if($dec>=0)
	{
		array_unshift($navigation,'<span class="navi"> <a href="./?q='.$_GET['q'].'&start='.$dec.'">'.$decp.'</a> </span> '."\n");
		$tcnt++;
	}
	if($tcnt>=10) break;
}
$navigation=join("",$navigation);
// end navigation	

 

Can someone advice me how to fix this plaese?

Thanks

Link to comment
https://forums.phpfreaks.com/topic/178395-solved-search-function-navigation-help/
Share on other sites

  • 3 weeks later...

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.