This topic is locked

some help new with php/mysql

10/15/2006 1:37:42 AM
PHPRunner General questions
F
franmb author

i need some help to try to understand those topics(i know that can be boring for a lot of you, i bought phprunner without any programming experience and i suppose that if tables and relationships between

them are not correct the rest of the script won´t work well):

i have 2 tables:

MASTER TABLE:

table _ADMINS(to add adminsitrators )

select `admin_ID`, /// primary key

`admin_name`,

`admin_password`,

`admin_var`

From `_ADMINS`

primary key is admin_ID
and
table _ADMIN_IPs(to add different allowed ips for every administrators)

select `admin_ID`, /// i use this field like foreign key

`admin_ip_ID`, /// primary key

`admin_IP`

From `_ADMIN_IPs`

primary key is admin_IP_ID but do i have to select admin_ID like primary key too???
_ADMINS table is the master of_ADMIN_IPs table, i selected setting up the master relationship between those tables like primary key from _ADMINS table admin_ID and foreign KEY from _ADMIN_IPs table admin_ID. Then at key colummns what do i have to select, i selected from _ADMINS table primary key admin_ID like key column and from table _ADMIN_IPs primary key admin_ip_ID like key column but do i have to select admin_ID like key column too???. When i want to add a new ip to _ADMIN_IPs table i select admin id from dependent drop-down box with all admin_ID of master table _ADMINS.

I'm not able to see the differences between choosing one or more primary keys and one or more key columns, my script always does the same.

If i try to add a new record for the primary key of one of the tables and already exists in my database then is not allowed but if i selected 2 primary keys building the table i can add as many records as i want with same value for the second primay key that i selected. And for key columns the same it seems that script just looks at the first primary key.

The idea is to do the table administrators like master table for administrators allowed ips and from table administrators be able to acces for every administrator added to all his allowed ips.

Could somebody explain me how to build correctly these two tables, select primary key/s, how to set up master relationship selecting primay and foreign key, which columns keys i have to select for every table and why you do.

thanks a lot

Alexey admin 10/16/2006

Hi,
here is the recommended setup.
Open the Datasource table tab in PHPRunner, set cursor to _ADMIN_IPs table and choose

Master table - _ADMINS

Primary key - admin_ID

Foreign key - admin_ID
Then proceed to the Choose pages tab and select admin_ip_ID as a key for _ADMIN_IPs and admin_ID - for _ADMINS.