PDA

View Full Version : PHP- JokeSite 2.0



InfamousNomie
April 17th, 2004, 21:41
i have a problem with my jokesite and i couldnt find help nowhere else

at the bottom of the page there is << 1 2 3 >> number for other pages

but the link on those #s are "/jokes_category.php?from=y&" y is where the # of jokes on the page and follow on but it should be like "/jokes_category.php?from=y&cat_id=x" X is where the # of category

for example when i have 15 jokes in category #2 and its showing ten on one page and 15 on other so the link for the next page shud be like this "/jokes_category.php?from=10&cat_id=2" BUT it makes the link like this "/jokes_category.php?from=10&" where "cat_id=2 is missing...



/****************************************************/
// Next prevoius using numbers
/****************************************************/
function make_next_previous_with_number($from, $SQL, $filename, $vars, $display_nr)
{

$count = bx_db_num_rows(bx_db_query($SQL));
@$active = ($from+$display_nr) / $display_nr;
@$total_pages = ceil($count/$display_nr);

if ($active <= $display_nr)
{
if ($active>1)
{
echo "<a href='".$filename."?from=0&".$vars."'><img src=\"".DIR_IMAGES."first.gif\" border=\"0\"></a>&nbsp;&nbsp;<a href='".$filename."?from=".($active*$display_nr-2*$display_nr)."&".$vars."'><img src=\"".DIR_IMAGES."previous.gif\" border=\"0\"></a>&nbsp;&nbsp;";
}

for ( $i = 1 ; $i <($active + $display_nr) && $total_pages >=$i ; $i++ )
{
if ($active == $i)
{
if ($count > $display_nr)
echo "<b>".$i."</b> ";
}
else
echo "<a href='".$filename."?from=".($i*$display_nr-$display_nr)."&".$vars."'>".$i."</a> ";
}
if ($count > $active && $count > $active*$display_nr)
{
echo "&nbsp;&nbsp;<a href='".$filename."?from=".($active*$display_nr)."&".$vars."'><img src=\"".DIR_IMAGES."next.gif\" border=\"0\"></a>";
echo "&nbsp;&nbsp;<a href='".$filename."?from=".(ceil($count/$display_nr)*$display_nr-$display_nr)."&".$vars."'><img src=\"".DIR_IMAGES."last.gif\" border=\"0\"></a>";
}
}
else
{

if ($active>1)
{
echo "<a href='".$filename."?from=0&".$vars."'><img src=\"".DIR_IMAGES."first.gif\" border=\"0\"></a>&nbsp;&nbsp;<a href='".$filename."?from=".($active*$display_nr-2*$display_nr)."&".$vars."'><img src=\"".DIR_IMAGES."previous.gif\" border=\"0\"></a> ";
}

for ( $i = $active - $display_nr ; $i < ($active + $display_nr) && $total_pages >= $i ; $i++ )
{
if ($active == $i)
echo "<b>".$i."</b> ";
else
echo "<a href='".$filename."?from=".($i*$display_nr-$display_nr)."&".$vars."'>".$i."</a> ";
}

if ($count > $active * $display_nr)
{
echo "<a href='".$filename."?from=".($active*$display_nr)."&".$vars."'><img src=\"".DIR_IMAGES."next.gif\" border=\"0\"></a>";
echo "&nbsp;&nbsp;<a href='".$filename."?from=".(ceil($count/$display_nr)*$display_nr-$display_nr)."&".$vars."'><img src=\"".DIR_IMAGES."last.gif\" border=\"0\"></a>";
}
}

}



where could be the problem...


i have attached the whole php file in there too its in txt format...

thankx for any kind of help

InfamousNomie
April 18th, 2004, 21:05
i guess no one can help me :frown2:

spec
April 19th, 2004, 11:37
your variable vars is probably not being passed, or is empty. echo it out and if that works then move on to the next step of debugging.



<?
//...
echo $vars;
$count = bx_db_num_rows(bx_db_query($SQL));
//...
?>


also does vars include "cat_id=" ???
please post the code that creates that string

InfamousNomie
April 20th, 2004, 22:06
yes it includes cat_id it shud be like this "cat_id=???" what eva the value is

InfamousNomie
April 20th, 2004, 22:12
yeah i put that line in but no use still the same

spec
April 21st, 2004, 21:48
if you added echo $vars did it actually print the value out?

InfamousNomie
April 22nd, 2004, 22:53
nope no value

spec
April 22nd, 2004, 23:10
then the problem is prior to your function

InfamousNomie
April 23rd, 2004, 08:23
here is the whole file called general.php that function is in it

general.php (http://members.lycos.co.uk/looneyw/shouts.txt)

mattsoft
April 30th, 2004, 00:26
still need help with this? maybe I can help you get it to work.

Cirkin
April 30th, 2004, 06:57
what is your scripts download page ?

Floy
December 20th, 2005, 06:11
How to solve this problem ???:nervous: