smokeydj Posted February 24, 2007 Share Posted February 24, 2007 Hi I hope some one can help me I am having trouble display data on multiple pages the code works fine on it's own but when the code is in an include on another page it does not work. <?php include 'videocon.php'; if(!isset($page)) $page = 0; //display data echo "<table border='0' cellpadding='3' cellspacing='1' width='100%' class='forumline'>"; echo "</table>"; echo "<center>"; echo "<table background='../images/archivebanner.jpg' width='716' height='135' border='0'>"; echo "<tr>"; echo "<td></td>"; echo "</tr>"; echo "</table>"; $txt1="http://www.eurosmokersclub.com/videos/video.php?source="; $txt2="&player=windows&form=yes"; $query = "SELECT * FROM table WHERE allowed='yes' ORDER BY date LIMIT " . $page . ", 6"; $result = mysql_query($query); echo "<center>"; echo "<table>"; $i = 1; if ($i == 1) { echo "<tr>"; } while($row = mysql_fetch_array($result)) { echo "<td background='.videobg.jpg' width='237' height='256'>"; echo "<center>"; echo "" . $row['name'] . ""; echo "<br>"; echo "<br>"; echo "<a href=" . $txt1 . $row['link'] . $txt2 .">"; echo "<img src=" . $row['picture'] ." border='0' width='180' height='122'>"; echo "</a>"; echo "<br>"; echo "<br>"; echo "<div align='left'>"; echo "<font size='2'> Posted By: <b><font color='#3f75e0'>" . $row['name'] . "</b></font>"; echo "<br>"; echo "<font size='2'> Date Posted: <b>" . $row['date'] . "</b></font>"; echo "</div>"; echo "</td>"; if ($i >= 3) { $i = 1; echo "</tr>"; } else { $i++; } } echo "</table>"; // get rows from table $query = "SELECT count(*) as count FROM table"; $result = mysql_query($query); $row = mysql_fetch_array($result); $numrows = $row['count']; echo "<br>"; if($page > 0) echo "<a href=\"" . $PHP_SELF . "?page=" . ($page - 6) . "\">Previous</a>\n"; echo " | "; if($numrows > ($page + 6)) echo "<a href=\"" . $PHP_SELF . "?page=" . ($page + 6) . "\">Next</a><BR>\n"; ?> When you click next nothing happens, but it works fine if you open this page by its self. its something to do with it being and include, I tried changing the include on the main page to: if(ereg("^[0-9]+$", $_GET['page'])) { header("Location: " . archive.php . "?page= . ($page + 6) ."); But this would'nt work because page=6 is only there when the archive page is open, I think maybe the problem is more with archive.php Hope someone can help? Im stuck :'( Link to comment https://forums.phpfreaks.com/topic/39898-solved-help-with-displaying-data-from-mysql/ Share on other sites More sharing options...
Archadian Posted February 24, 2007 Share Posted February 24, 2007 what is all the "." in your header() url? you don't have any variables in it, Also try $_SERVER['PHP_SELF'] instead of $PHP_SELF Link to comment https://forums.phpfreaks.com/topic/39898-solved-help-with-displaying-data-from-mysql/#findComment-192880 Share on other sites More sharing options...
smokeydj Posted February 24, 2007 Author Share Posted February 24, 2007 Sorry I posted wrong code its actually this: if(ereg("^[0-9]+$", $_GET['page'])) { include("archive.php?page=".$_GET['page']); } else { include("archive.php"); } But I think archive.php needs to be called before archive.php?page=6 will be there. So when this happens include("archive.php?page=".$_GET['page']); It says: Warning: main(archive.php?page=6) [function.main]: failed to open stream: No such file or directory in. Because archive.php needs to be present so archive.php?page=6 can be found. Please help im pulling my hair out!! (archive.php works fine by its self) Link to comment https://forums.phpfreaks.com/topic/39898-solved-help-with-displaying-data-from-mysql/#findComment-192914 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.