Help me?

Forget

Member
Apr 3, 2012
120
14
Hello,
Okay so the issue i have is making pages for my information, i want to split my code into different pages depending on what the page id is from a get request. I simply have no idea to work out how to code this haha. What i have done so far as a trying, not sure if it works, havn't tested it.

<?php
//gets the id (index.php?id={this}) and filters
$id = filter($_GET['id']);

//results per page
$results = 20;

//query for getting comments
$q = mysql_query("SELECT * FROM news_comments WHERE new_id = '{$id}'");

//counts amount of comments
$c = mysql_num_rows($q);

//Works out how many pages i will need
$pageamount = ceil($c/$results);

//Finds get page and if blank uses 1
if(!isset($_GET['page'])) { $page=1; }else{ $page=$_GET['page']; }
?>

Don't know from here? haha anyone help me?
I could use limit but that would only work for the first page.
 

Users who are viewing this thread

Top