whats wrong with my functions?
Posted: Tue Jul 02, 2002 10:09 pm
I have 3 scripts search.php-->pageNav.php-->navFuncs.php
they are inluded one in the other with search being the display page.
search.php is the search script, pageNav.php is a script for generating
<--Prev 1 2 3 Next--> links, and navFuncs contains functions for printng Next 123 and Prev called nNext() nPrev() and nNums().
for some reason, navFuncs.php does not seem to be able access any variables from the query inside of condional statements.
help?
Relevant code parts:
search.php
pageNav.php
navFuncs.php (One function, i believe they will al work if we get this one working)
they are inluded one in the other with search being the display page.
search.php is the search script, pageNav.php is a script for generating
<--Prev 1 2 3 Next--> links, and navFuncs contains functions for printng Next 123 and Prev called nNext() nPrev() and nNums().
for some reason, navFuncs.php does not seem to be able access any variables from the query inside of condional statements.
help?
Relevant code parts:
search.php
Code: Select all
<br>
<br>
<?include("pageNav.php");?>
<br>
<br>pageNav.php
Code: Select all
<?
include("navFuncs.php");
if($totalResults > 0 && $totalResults - ($pageNumber * 20) > 0 && $pageNumber != 1)
{
nPrev();
nNums();
nNext();
}
elseif($totalResults >= 1 && floor($totalResults/20) >= $pageNumber-1 && $pageNumber != 1)
{
nPrev();
nNums();
echo "<span style='color:gray;font-family:arial;font-size:12pt;'>Next--></span>";
}
elseif($totalResults > 0 && $totalResults - ($pageNumber * 20) > 0 && $pageNumber == 1)
{
echo "<span style='color:gray;font-family:arial;font-size:12pt;'><--Prev</span> ";
nNums();
nNext();
}
else
{
echo "<span style='color:gray;font-family:arial;font-size:12pt;'><--Prev</span> ";
nNums();
echo "<span style='color:gray;font-family:arial;font-size:12pt;'>Next--></span>";
}
?>Code: Select all
function nNext()
{
echo "<a href="javascript:location.href('search.php?orderby=$orderby&resultCount=";
echo $resultCount+20;
echo "&pageNumber=";
echo $pageNumber+1;
echo "&submit=Search&rowsToShow=20&resultsStart=";
echo $resultsStart+20;
if(isset($category)){
echo "&category=$category";
}
if(isset($adv)){
echo "&adv=1";
}
if(isset($model)){
echo "&model=$model";
}
if(isset($manufacturer)){
echo "&manufacturer=$manufacturer";
}
if(isset($year)){
echo "&year=$year";
}
if(isset($price1)){
echo "&price1=$price1";
}
if(isset($price2)){
echo "&price2=$price2";
}
echo "')" class='navLink'>Next--></a>";
}