Need help/w Page: 1,2,3,4 function!


Posted on 16th Feb 2014 07:03 pm by admin

So I have this code im working on where it's ment to display seperate pages having 20 logs each
I'm having SOOOOOOOOO much trouble with it... it's supposed to work! >,<

I get the right amount of Pages 1,2,3,4, but when I click on them it doesn't show up right =(

http://www.clan-wd.com/test.php


<?php
include "config.php";



if($page == NULL) {
$page = 0;
} else {
$page = $page - 1;
}
global $myrow;
extract($myrow);


if($p == "") {

echo "<table width='100%' border='3'>";

// Counting Codes #########
$result = @mysql_query("SELECT COUNT(*) FROM logs");
$count = mysql_fetch_array($result);
$count = $count[0];

$num_pages = ($count / 20) + 1;
$limit = 20 + $startNum * 20;
$i = 0;


$result = @mysql_query("SELECT * FROM logs ORDER BY id DESC");
while(($row = mysql_fetch_array($result)) && $i <= $limit) {
extract($row);

if($i >= ($startNum * 20)) {
echo "
<tr><td><b>$id - $logName</b> $date</td></tr>
";
}
$i++;
}
echo "
</table>
<p align=left><b>Page:</b>
";
for($i = 1; $i <= $num_pages; $i++) {
echo "<a href=test.php?page=$i>$i</a>";
}

}


?>

No comments posted yet

Your Answer:

Login to answer
311 Like 48 Dislike
Previous forums Next forums
Other forums

Help with usergroups? prolly really quick
So were coding our own forums for a game system we made an we have the users level setup but now I n

PHP5 - AJAX help
I've been following the tutorial on w2schools (http://www.w3schools.com/php/php_ajax_database.asp) a

How to read CSS message data
Hi,
I have a requirement here. When working as a Dev angel for multiple customers its really di

Cannot Connect to Database
I am writing an application to do annual reviews. I cannot get my script to work. Whenever it runs I

tell csv import script to ignore blank rows?
Hi i have the below script but i get an error if a row is blank ie a return in the csv file at the e

keeps going back to index.html ???????
ok so i started making my site using mostly.html files now i have added a fair chunk of php. My inde

MASS PM
Hello all, I'm trying to send mass private messages to users in my database but keep getting an erro

Best way to cross matching large datasets
Hi,

Im running a script where am I cross matching about 200 000 data sets with each other. Ea

Contact Form Not Working When I Add Validation Codes
So I built my first working PHP "Contact Us" like form. But, I have been trying to now mak

Random Number Generation And Probability
Hello, I am working on a function which has to insert data into a SQL table.

we have to suppl

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash