Jump to content

Pagination doesn't display the results - Huge problem..


Recommended Posts

I'll try again. I have pagination which displays "values" However.. the database at the moment, has 3 users. I am trying to display all users. I am using pagination for when more users sign up.

 

I set the variables, do the database queries. I can not find a problem for this. I need someone to help me out... It's giving me a headache, I really can't figure it out.

 

The values that do display, being as I have 3 collumns. Username, Email, Admin Access. The values for each of them are "1" I have tried numerous methods to sort this problem.

Instead of accessing database, I used something like..

$username = array "bill", "bob", "henry", "elizabeth";

These come up perfect in the table.. but when I access the database, for some reason that doesn't work.

Part of one of the methods I tried, is having it display the username from the database only. the username comes up in the right collum. Though, only one letter each row. EG:

A

D

M

I

N

 

It doesn't go across in the same row as "ADMIN"

Also another method I tried, which was setting it without the "while(){" That bought up the only 1 row of values of my username, email and Admin access. Although.. The first letter of each. EG:

A          T            1

(A = Admin, T = My Email Address, 1 = Admin Access)

 

Here is my code

 

<?php
require_once ("Pagination/Paginated.php");
require_once ("Pagination/DoubleBarLayout.php");

  $getusers = mysql_query("SELECT Username, Email, Admin FROM Users")or die(mysql_error());
  $userdata = mysql_fetch_array($getusers);

$page = $_GET['page'];

//constructor takes three parameters
//1. array to be paged
//2. number of results per page (optional parameter. Default is 10)
//3. the current page (optional parameter. Default  is 1)
$pagedResults = new Paginated($userdata['Username'], 10, $page);
$pagedResults1 = new Paginated($userdata['Email'], 10, $page);
$pagedResults2 = new Paginated($userdata['Admin'], 10, $page);

echo '<table border="1">';

while($row = $pagedResults->fetchPagedRow() && $row1 = $pagedResults1->fetchPagedRow() && $row2 = $pagedResults2->fetchPagedRow()) {	//when $row is false loop terminates
	echo '<tr><td>'.$row.'</td><td>'.$row1.'</td><td>'.$row2.'</td></tr>';
}

echo '</table>';

//important to set the strategy to be used before a call to fetchPagedNavigation
$pagedResults->setLayout(new DoubleBarLayout());
	$pagedResults1->setLayout(new DoubleBarLayout());
		$pagedResults2->setLayout(new DoubleBarLayout());

echo $pagedResults->fetchPagedNavigation();
	echo $pagedResults1->fetchPagedNavigation();
		echo $pagedResults2->fetchPagedNavigation();
?> 

 

Whats the problem? thank you!

Rule 17

Users should not "bump" topics that are still on the first page of the forums. If you bump, you must provide additional information. If you resort to bumping, chances are your question needs to be re-thought and re-described (see Eric Raymond's "How To Ask Questions The Smart Way").

 

I'll be honest, I looked at this thread ans skipped it, as there's not really any detail to work with, if you wrote the classes then your know have an idea of where the problem is, if you didn't then any helper would need to dig thought the classes and ask for every little detail,

 

also i don't see a clearly stated problem (ie what your getting / expecting)

Just.. fuck off and die. Seriously.. I couldn't of made it any more clearer.

 

I bumped it, because I needed help.

 

It was clearly stated that the results I was getting never came out the way I wanted them to.

As an example, it should of been put into a table like..

 

Username              Email              Is Admin

Admin                my email                1

  bill                there email              0

 

etc etc. Yet it comes out totally different as I explained.

Just.. fuck off and die. Seriously.. I couldn't of made it any more clearer.

 

I bumped it, because I needed help.

 

It was clearly stated that the results I was getting never came out the way I wanted them to.

As an example, it should of been put into a table like..

 

Username              Email              Is Admin

Admin                my email                1

  bill                there email              0

 

etc etc. Yet it comes out totally different as I explained.

 

You know that example cleared up most of what I wanted to know..

But Seriously do you think I am going to help now ?

You know I skip many posts, this is a FREE service after all,

 

Ideally, if you didn't know enough information, you should "ask"

My post was an intended to help you get help from myself or someone else, the fact I even took the time to tell you why I skipped it should give you some insight why your not getting help, because believe it or not many people skip posts,

You know I could of saved myself a lot of trouble and just no replied as I did on the first visit!

 

Look at the topic (Read 67 times at the time of this post!)

I have replied 2 twice, that's 65 visitors who skipped this post!

 

if it came a cross in a negative way then, I'm sorry but I was only trying to help.. as many people get frustrated when they get no replies and start bumping..

I bumped it, because I needed help.

everyone who posts in the 'PHP Coding Help' section wants help but they don't all bump!

 

Now.. in an attempt to continue with the problem!

 

the code you have posted doesn't work, So could you post a var_dump() of $row, $row1 and $row2

and also posting some code that works with the array would probably help

example for var_dump

 while($row = $pagedResults->fetchPagedRow() && $row1 = $pagedResults1->fetchPagedRow() && $row2 = $pagedResults2->fetchPagedRow()) {   //when $row is false loop terminates
var_dump($row); //ADD
var_dump($row1); //ADD
var_dump($row2); //ADD
die(); //ADD
      echo '<tr><td>'.$row.'</td><td>'.$row1.'</td><td>'.$row2.'</td></tr>';
   }

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.