Solved

With a master - detail list of db values spanning 3 pages, how do I stop the list defaulting back to page 1 after a value has been selected?

Posted on 2007-11-27
5
201 Views
Last Modified: 2013-12-12
Okay - very unclear question title. Sorry. I'll try to explain.

Basically I have a master - detail type page which is drawing information from a MySql database. On the right hand pane of my webpage are a list of names of teachers (master). Clicking on these names reveals more information on these teachers (details) in the left hand pane of the website.

There are 20 teachers listed in the list of teachers on the right hand side pane. Clicking on the arrows at the bottom of the pande, reveals the next 20 teachers in the database, and so on.

The problem is that if I am viewing the second page of teachers (i.e - not the first 20, but the next 20) and I click on one of the teacher names to see more information, the information is displayed BUT the list refreshes back to the first 20 which were on the list.

Essentially, when I click on a teacher name to view details, how can I stop the page from going back to display the first 20 (or whatever value I specified) in the DB.

An example of this problem can be viewed at:
http://www.privatelesson.co.uk/TeacherProfile.php?teachertype=&location=&recordID=7299

If you press the arrow button at the bottom if this screen, it will take you on the next list of teachers and if you select one of these, the list refreshes to display the first 20 in the db.

Many thanks for reading this.
0
Comment
Question by:ayounis
  • 3
  • 2
5 Comments
 
LVL 11

Expert Comment

by:AlexanderR
ID: 20361880
It should really be in an iframe of some kind so it stays the same and does not waist resources when you click around.
But as a quick fix, around each name in the list you need to have something like


echo '<a href=http://www.privatelesson.co.uk/TeacherProfile.php?teachertype=&location=&recordID=7267&pageNum_m='.$_GET['pageNum_m'];

basically put &pageNum_m='.$_GET['pageNum_m'] at each link in the list

Open in new window

0
 

Author Comment

by:ayounis
ID: 20387956
Thanks AlexanderR.
Sorry about the late response to your solution. I can't really code, and am having some problems implementing your solution. The line of code which I guess you are referring to is this one:

<a href="MemberProfiles/MmNewMemberTeacherProfile0.php?&language=<?php echo $_GET['language'] ?>&prefecture=<?php echo $_GET['prefecture'] ?>&recordID=<?php echo $row_m['autonumber']; ?>" class="style45"><font size="1" face="Arial, Helvetica, sans-serif"><?php echo $row_m['firstname']; ?>

And the link to the details is on the 'firstname' link.

Where should I put the '&pageNum_m='.$_GET['pageNum_m']' link on this line?

Thanks
0
 
LVL 11

Expert Comment

by:AlexanderR
ID: 20388973
I hope we are talking about the same links here.  On the link that you provided, each teacher record has links similar to http://www.privatelesson.co.uk/TeacherProfile.php?teachertype=&location=&recordID=7233 not the kind in your latest post.

But if they both share the same pageNum technique it doesn't matter.  You should modify the links in your code to look like
<a href="MemberProfiles/MmNewMemberTeacherProfile0.php?pageNum_m='.$_GET['pageNum_m'].'&language=<?php echo $_GET['language'] ?>&prefecture=<?php echo $_GET['prefecture'] ?>&recordID=<?php echo $row_m['autonumber']; ?>" class="style45"><font size="1" face="Arial, Helvetica, sans-serif"><?php echo $row_m['firstname']; ?>

Open in new window

0
 
LVL 11

Accepted Solution

by:
AlexanderR earned 100 total points
ID: 20388977
sorry
<a href="MemberProfiles/MmNewMemberTeacherProfile0.php?pageNum_m=<?php echo $_GET['pageNum_m']; ?>&language=<?php echo $_GET['language'] ?>&prefecture=<?php echo $_GET['prefecture'] ?>&recordID=<?php echo $row_m['autonumber']; ?>" class="style45"><font size="1" face="Arial, Helvetica, sans-serif"><?php echo $row_m['firstname']; ?>

Open in new window

0
 

Author Comment

by:ayounis
ID: 20391097
That's perfect AlexanderR. Works a treat.

Many thanks.

0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
PHP and Soap 3 28
compressing images after upload 4 31
whm high memory usage in processes 7 38
uploading multiple image with php 14 19
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now