czukoman20 Posted June 5, 2008 Share Posted June 5, 2008 <?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 More sharing options...
Buddski Posted June 5, 2008 Share Posted June 5, 2008 Try echoing $dir.$username."_banner.".$type to see the result it may not be what you expect. Link to comment https://forums.phpfreaks.com/topic/108876-solved-pagination-issue-not-workin/#findComment-558499 Share on other sites More sharing options...
czukoman20 Posted June 5, 2008 Author Share Posted June 5, 2008 well.. i have no idea what any of this stuff means.. if its even right.. umm take a look http://www.adworld-online.com/browse/sto.php do u know what might be the cause of this it looks to me tho that its not picking up the username Link to comment https://forums.phpfreaks.com/topic/108876-solved-pagination-issue-not-workin/#findComment-558511 Share on other sites More sharing options...
Buddski Posted June 5, 2008 Share Posted June 5, 2008 try this $dir = dirname(__FILE__)."/images/banners/"; Also according to your echo.. the $username variable is returning NULL Link to comment https://forums.phpfreaks.com/topic/108876-solved-pagination-issue-not-workin/#findComment-558513 Share on other sites More sharing options...
czukoman20 Posted June 5, 2008 Author Share Posted June 5, 2008 how can it return null if the database has it set to not null Link to comment https://forums.phpfreaks.com/topic/108876-solved-pagination-issue-not-workin/#findComment-558516 Share on other sites More sharing options...
Buddski Posted June 5, 2008 Share Posted June 5, 2008 That first thing I said should fix the files location but its not recieving the $username variable.. Does the username row exist and or have data stored in the database Link to comment https://forums.phpfreaks.com/topic/108876-solved-pagination-issue-not-workin/#findComment-558518 Share on other sites More sharing options...
czukoman20 Posted June 5, 2008 Author Share Posted June 5, 2008 Ok h/o a sec.. i might have found the issue.. with the userid.. might be making the username null for now Link to comment https://forums.phpfreaks.com/topic/108876-solved-pagination-issue-not-workin/#findComment-558522 Share on other sites More sharing options...
Buddski Posted June 5, 2008 Share Posted June 5, 2008 If you want to test the file locations are working you can always define the $username manually to see if its all working for when the sql pulls into line Link to comment https://forums.phpfreaks.com/topic/108876-solved-pagination-issue-not-workin/#findComment-558527 Share on other sites More sharing options...
czukoman20 Posted June 5, 2008 Author Share Posted June 5, 2008 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 Link to comment https://forums.phpfreaks.com/topic/108876-solved-pagination-issue-not-workin/#findComment-558531 Share on other sites More sharing options...
Buddski Posted June 5, 2008 Share Posted June 5, 2008 Hope ive been able to help you a bit at least.. Link to comment https://forums.phpfreaks.com/topic/108876-solved-pagination-issue-not-workin/#findComment-558538 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.