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
207 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
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…
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

770 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