This topic is locked

Editing/Adding Records while in Detail/Master mode

5/19/2005 1:53:21 PM
PHPRunner General questions
roy author

While I have selected detail records from detail table, if I try to edit the record and then click on "return to list" it return to the first record in the detail table rather than the record I've just edited. More often than not, it returns to a detail record not even associated with the master table record I selected detail from.
Along those same lines, but not exactly the same problem, I have a master table called "markets" and 2 tables connected to it as detail called "rates" and "publications." When I select a particular "market", then look at the detail in "rates" or "publications" all is well until I go "Back to Master table." When I do that, I get a "Your session has expired. Please login again " message.
Next, when I Add a record from a detail list, how can I have the link field default to the "Master" record I'm working with?
Help! I'm up against a bunch of hungry lions, that's anxious users and management. :-)
I really like PHPRunner and this application is coming together rather well. An old Cobol programmer like me would never have gotten this far in this little time without it. The more is use PHPRunner, the more I learn. Thanks for a great product.
Roy

K
Knud van Eeden 5/19/2005

Have you already tried it with PHPRunner v2.0 beta 2?
http://www.asprunner.com/forums/index.php?...?showtopic=1340
it solves quit a few issues in general.

K
Knud van Eeden 5/19/2005

> I Add a record from a detail list, how can I have the link field default to the "Master" record I'm working with?
When you start from the master table,
and click on the detail table hyperlink,
then goto 'add new' in that detail table,
then that master table entry is connected to that new detail table,
(as far as I know currently).

K
Knud van Eeden 5/19/2005

and you get a detail table hyperlink, if you enable the checkbox
[x] 'Display master table info in the detail page'
in the PHPRunner screen 'Datasource table'
for that particular table.

K
Knud van Eeden 5/19/2005

PHPRunner: Table: How to create a hyperlink from a master table to its detail tables?

http://www.faqts.com/knowledge_base/view.p.../36345/fid/1805

501209 5/19/2005

Thanks, Knud.
"Have you already tried it with PHPRunner v2.0 beta 2?

http://www.asprunner.com/forums/index.php?...?showtopic=1340

it solves quit a few issues in general."

Yes, I'm using v2.0 beta 2.
> I Add a record from a detail list, how can I have the link field default to the "Master" record I'm working with?
When you start from the master table, and click on the detail table hyperlink, then goto 'add new' in that detail table, then that master table entry is connected to that new detail table, (as far as I know currently).
... and you get a detail table hyperlink, if you enable the checkbox

[x] 'Display master table info in the detail page'

in the PHPRunner screen 'Datasource table' for that particular table.

That's what I'm doing, but it's pointing to the first entry in the master table. So, I have to select the proper master table entry.
PHPRunner: Table: How to create a hyperlink from a master table to its detail tables? http://www.faqts.com/knowledge_base/view.p.../36345/fid/1805
I viewed the info at the provided link and that's the way I'm doing it, except for one detail. The column in the detail table that is used to link to the master table isn't defined as a foreign key.
How do I do that?
Thanks,

Roy

roy author 5/19/2005

Sorry, that last reply from "guest" was actually me - roy. Thanks for your help, this is really bugging me.

Roy

K
Knud van Eeden 5/19/2005

Database: MySQL: Key: Foreign: Operation: Create: How to create a foreign key in MySQL? [InnoDB]

http://www.faqts.com/knowledge_base/view.p...d/34396/fid/183
---
Thus you basically add the following lines to each your detail table in MySql
CREATE TABLE tableMyDetailName (

...

INDEX ( columnMyForeignKey ),

FOREIGN KEY ( columnMyForeignKey ) REFERENCES tableMyMasterName ( columnMyMasterPrimaryKey )

)

TYPE = INNODB;

roy author 5/19/2005

Great! Thanks, Knud. That may solve some other problems for me too.
As far as the session expired errors go, I have encountered something interseting. I offloaded all the generated code and a backup of the database to a CD. Took it home and loaded it on my home desktop and it worked without any session expired errors.
Also, the screens display differently between IE 6.0 and Mozilla Firefox 1.0.2. The code is generated using style 1 (default) and that's what it looks like on IE, but on Firefox it displays like style 5. Now, that's odd!!!
I will recreate things using the information you provided. For my file type, I have been using TYPE = MYISAM.
Thanks again,

Roy

K
Knud van Eeden 5/19/2005

About browsers, my project runs OK on

  1. Internet Explorer v6
  2. Firefox

    (but I did not check for colors, only the structure which remained OK)
    but not on
  3. Opera
    (which did show deformation of the table structure).

K
Knud van Eeden 5/19/2005

Database: MySql: Backup: How to backup your MySql databases on Microsoft Windows? [mysqldump.exe]

http://www.faqts.com/knowledge_base/view.p...id/35219/fid/52

K
Knud van Eeden 5/19/2005

For foreign keys, your table should be of type
InnoDB
(thus not MYISAM)
or it might/will not work as designed,

as far as I know.

roy author 5/20/2005

Thank you, Knud. The information you provided was very helpful.
I created a test database using foreign keys with some of my actual data. It worked very well. Now to check it out with PHPRunner and a test of all the components and relationships of my complete database.
Thanks again,

Roy

K
Knud van Eeden 5/22/2005

Foreign keys definitions are subject to the following conditions:
Both master and detail table must be of type 'InnoDB'
http://dev.mysql.com/doc/mysql/en/innodb-f...onstraints.html

K
Knud van Eeden 5/22/2005
roy author 5/22/2005

Thanks again, Knud, your responses are very helpful. The conversion to InnoDB from MyISAM has been completed and my PHPRunner application has been converted as well.
I'm still experiencing the problem in adding new detail records and having them linked to the proper master record, in a user friendly -- read that SAFE AND WITH DATA INTEGRITY -- manner.
Let me give an example:

I'm displaying a Client Record,

This record has links to contacts and contracts.

I click on the link to contracts and display the open contracts with that client

Let's just say there are 8 contracts associated with that client - they display just fine.

A new contract comes in from sales for that client, and I want to add it.

When I click "Add New" while displaying the sub-set of contracts that are associated only with that client, the client_id for the Client table is pointing to the top of the Client table.

I can enter any valid client_id and it accepts the record.
Question #1?

How can I make the added detail record link by default to the currently selected master record?

Also, I have a Users table which has demographic info about each user, in addition to their username and password. I would like to restrict access to the users table to only the logged in user list, view, and edit. I would also have an admin user who will have access to all user records and delete capability as well. In fact, the admin user should be the only user with the ability to delete entries from any table. I may want to expand the security scheme in the future to include certain managers more access. I just don't want to do that right now when I am so early in my learning of PHP/MySQL. I can do enough damage without their help! ;-)
Question #2?

How would you suggest I handle the security issue, particulary users having access to only their own record?

Question #3?

Does anyone have any recommendations for a good report generator that will generate PHP code that could be linked to the PHPRunner menu, under a "Reports" selection? Maybe go to a sub-menu of available reports, or something like that. Any suggestions on that would be greatly appreciated.

I have a table, called Publications that has a series if dates reflecting various critical points in the production cycle. These dates are computed based on a certain number of days preceeding the date the publication is to be delivered to the post office (called the in_home_dt). I would prefer that the user entering the information not have to calculate those milestone dates.
Question #4?

Is there a way I can get access to the record as it's added or if the in_home_dt has been changed in an edit?

I sure hope I haven't broached too many topics in this post. I apologize if I have.

This forum has been extremely helpful to me, and PHPRunner has allowed me to create this application far faster than I would have been able to do it otherwise. I'm a total newbie to PHP/MySQL/Apache, coming from a mainframe COBOL background, and that many years ago.
Thanks,

Roy Maul