Page 1 of 1

User the Same Table for 2 Links

Posted: Tue Sep 24, 2013 11:56 pm
by testuser

Hi all,

I have a user table with user type IDs for each record (1=teacher; 2=student). I want to show 2 links on the menu: Teachers and Students. The teacher list has a filter "UserTypeID=1" and the student list has a filter "UserTypeID=2". Is there a way to do it with PHPMaker 10? Thanks.


Re: User the Same Table for 2 Links

Posted: Wed Sep 25, 2013 9:37 am
by danielc

Use Menu Editor to add your Menu Item, like Teacher and add URL as xxxlist.php?UserTypeID=1

For your table, click [Table] tab, setup [Filter]:
(isset($GET["UserTypeID"]))? "yourfield = " . $GET["UserTypeID"] . "":""


Re: User the Same Table for 2 Links

Posted: Wed Sep 25, 2013 11:58 pm
by testuser

Thanks danielc.

I tried it and there are 2 problems:

  1. I added xxxlist.php?UserTypeID=1 as a menu item "Teachers" and xxxlist.php?UserTypeID=2 as a menu item "Students". When open the teacher link, both menu item links of "Teachers" and "Students" are disabled.

  2. When I open xxxlist.php?UserTypeID=1, it shows all teachers. But when I click on the header to sort any column, it shows teachers and students.

Please let me know how to fix them. Thanks.


Re: User the Same Table for 2 Links

Posted: Thu Sep 26, 2013 9:23 am
by danielc

If you click on the header to sort, the table is still xxxlist.php but without the search value. So, it will show the full list.

So, you need to create a view to add the filter. Right click your table to select [Create View], add your table and tick all fields and in criteria column belong to UserTypeID row to add =1 or =2. Then Click ok (remember to change view name to teacher or student). A database view will be created.


Re: User the Same Table for 2 Links

Posted: Tue Oct 08, 2013 1:37 am
by testuser

That works fine. Thanks.