Jump to content

[SOLVED] Pagination issue... not workin


czukoman20

Recommended Posts

 <?php
@mysql_connect("db1093.perfora.net", "dbo215169417", "TkA.Btc7") or die(mysql_error());
@mysql_select_db("db215169417") or die(mysql_error());
if (!(isset($pagenum)))
{
$pagenum = 1;
}
$data = mysql_query("SELECT * FROM users WHERE type_market = 'stocks' ORDER BY rand()") or die(mysql_error());


$rows = mysql_num_rows($data);
$page_rows = 4;
$last = ceil($rows/$page_rows);
if ($pagenum < 1)
{
$pagenum = 1;
}
elseif ($pagenum > $last)
{
$pagenum = $last;
}
$max = 'limit ' .($pagenum - 1) * $page_rows .',' .$page_rows;
$data_p = mysql_query("SELECT * FROM users WHERE type_market = 'stocks' $max ") or die(mysql_error());
while($values = mysql_fetch_array( $data_p ))
{
echo "<br>";;
   $username = $values['username'];
if($session->logged_in)
{
$sub = "submit2.php";
}else{
$sub = "submit2.php";
}

$types = array("jpg","gif","png","swf");
$dir = dirname(__FILE__)."../images/banners/";
foreach($types as $type)
{
if(file_exists($dir.$username."_banner.".$type))
{
	echo "<a href=\"http://www.adworld-online.com/$sub?user=$username\"target="._blank."><img src=\"http://www.adworld-online.com/images/banners/".$username."_banner.".$type."\" width=\"600\" height=\"110\" border=\"0\"><br />";
}
}
}
echo "<p>";
echo " --Page $pagenum of $last-- <p>";
if ($pagenum == 1)
{
}
else
{
echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=1'> <<-First</a> ";
echo " ";
$previous = $pagenum-1;
echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$previous'> <-Previous</a> ";
}
if ($pagenum == $last)
{
}
else {
$next = $pagenum+1;
echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$next'>Next -></a> ";
echo " ";
echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$last'>Last ->></a> ";
}
?>

 

here is my pagination code.. for some reason.. the banners aren't showing up..

The user name is mattymatt415

the banner name is mattymatt415_banner.jpg

 

I have type market on the user set to stocks.

and the banner is there

http://www.adworld-online.com/images/banners/mattymatt415_banner.jpg

what could be the issue.. It senses the stocks being there.. but the banner does not show

 

(just in case anybody was wondering.. this code is supposed to track down any users in the database that have stocks under the type_market column, then finds the username of the user.. and checks for any banners in a certain directory.. and then when the directory says that there is one.. it will show the banner.)

 

help is greatly appreciated

Link to comment
https://forums.phpfreaks.com/topic/108876-solved-pagination-issue-not-workin/
Share on other sites

well the issue was... for some reason.. when that user signed up

it recorded a 0 into the userid which is null.. (its supposed to be md5'd) i have no idea what happened there..

U guys might have to watch out for another question when i find the source of this stupidity

 

thanks

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.