Skip to main content
Inspiring
December 17, 2010
解決済み

Recordset paging by A,B,C....instead of Next Page, Prev Page, etc.?

  • December 17, 2010
  • 返信数 1.
  • 6256 ビュー

Hello geniuses,

I was wondering if there is a way to do the following:

I currently have a member database (MySQL) that I manage for a client. Using DW CS4, I used the built-in Recordset paging to add a navigation bar to the top of the member listing, limiting it to 50 per page. Since there are so many members in this organization, my client has asked me to create an A,B,C...navigation bar, rather than First Page - Next Page - Prev Page - Last Page. Is there a way to do this? Note that if a member is added or dropped from the list and they happen to be the first of the B's (for example), then the marker has to move accordingly. Thanks for pointing me in the right direction.

Regards,

Gail

このトピックへの返信は締め切られました。
解決に役立った回答 Günter_Schenk

First, you were correct about the missing single quotes, and that solved

the problem. Thanks very much.

So, a feature it is! I guess there's no real harm done to load more at

the "first look" of the member list. It does work correctly for all

letters. You are right in that if I drop "maxusers" down to 10 or 20,

the bottom half of, say, the Bs, gets cut off.

I originally had the Recordset Paging Navigation Bar on my page, but my

client didn't like it because he had to page through and hunt for

members. Hence my determination to provide an A,B,C navigation for him,

which you have so kindly helped me with. I didn't think about using both

features - the paging navigation bar, plus the A,B,C navigation. That

would definitely solve the worry of someday going over 50 members in any

given letter and not noticing that the list is cut off. I'll add it back.

I want to thank you profusely for all your help on this. Not only have

you stuck with me, but your timely responses meant I could finish this

today. You are my new best friend!

Best regards,

Gail


Gail,

it´s been a real pleasure to participate in such an intense "dialogue", and I salute you for remaining persistent !

Cheers,

Günter

返信数 1

December 17, 2010

By A,B,C... do you mean that clicking on A will only show memebers whose name starts with A or do you mean like 1,2,3...10 etc where clicking on 1 will show the first 50 people that were entered into the DB? Please specify.

You can find useful information by searching for:

(your unmentioned server side scripting language) pagination

Gail Bergan作成者
Inspiring
December 17, 2010

I mean that clicking on A will only display those whose last names

start with A. Sorry for any confusion.

Gail

Gail Bergan作成者
Inspiring
March 28, 2011

Gunter,

If I do this instead:

------------

$query_listUsers = "SELECT user_id, lastname, firstname, email FROM users WHERE activity_status = 'y' ORDER BY lastname ASC";


if(!empty($_GET['letter']) && ctype_alpha($_GET['letter']))
{
    $whereclause = " AND lastname LIKE '".$_GET[letter]."%'";
}
else {
    $whereclause = "";
};

------------

I get the same result: the first 50 members are displayed regardless of lastname letter. There is something wrong with my coding but I don't know what it is.

Also, if I click on a letter, say D, I get the following in the browser:

Notice:  Use of undefined constant letter - assumed 'letter' in C:\wamp\www\2010 new site\list_users_abc_test.php on line 57

Line 57 has the following code: $whereclause = " AND lastname LIKE '".$_GET[letter]."%'";

Thanks,

Gail


and...if I put it here:

$query_listUsers = "SELECT user_id, lastname, firstname, email FROM users WHERE activity_status = 'y' if(!empty($_GET['letter']) && ctype_alpha($_GET['letter']))
{
    $whereclause = " AND lastname LIKE '".$_GET[letter]."%'";
}
else {
    $whereclause = "";
} ORDER BY lastname ASC";

I get this error in the browser:


Parse error:  syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\wamp\www\2010 new site\list_users_abc_test.php on line 54