This topic is locked

Transfer compound key data

7/11/2005 2:21:02 PM
PHPRunner General questions
jpedwardspost author

Hi,
I have a data relationship like below:
USER table (primary key user_id) and Master Of ->
PROPERTY table (compound primary key user_id;property_num) Master of ->
IMAGE table (compound primary key user_id;property_num;image_num)
Basically I am trying to get user_id into the IMAGE table.
Anyway of setting this up in phprunner.
Cheers

JP.

admin 7/12/2005

Hi,
some of your keys and relationships look unnecessary.
If your PROPERTY.property_num and IMAGE.image_num fields are auto_increment fields, you don't need compound primary keys. You can set up your keys as follows:
USER table

user_id - primary key
PROPERTY table

property_num - primary key

user_id - foreign key
IMAGE table

image_num - primary key

property_num - foreign key
In this case you don't need IMAGE.user_id field at all.

However if you need it for any other purpose, you can fill it automaticaly with the user_id value from USER table.
To do that open Formattingtab for IMAGE table in PHPRunner, click on Edit format column and enter the following default value:

@$_SESSION["PROPERTY_masterkey"]



Please note that tabe name is case-sensitive, so you should enter it exactly as it is named in database.

500293 7/13/2005

Thanks,

that bit of code worked nicely <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=5146&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />

JP