gadjodilo77
Programmer
Hi,
I have a difficult question. I am busy building some sort of registration application. With this application it is possible to register devices. But it has also to be possible to attach device to eachoter (for instance attach a computer to one or more monitors or attach a monitor to one or more computers). Herefore I have made a database with two tables; one to register the devices (they get a unique device_id which is primary key auto_increment) and another table to attach devices.
The attach table is made of 2 colomns:
monitor_id (which is a device_id of the devices table [of the monitor attached])
and the computer_id (which is a device_id of the devices table [of the computer attached])
For instance in the devices table there are a monitor with id 2 a monitor with id 1 and a computer with id 3.
I want to attach monitor 1 and 2 to computer 3
In the attach table it would look like this:
attach table
comp_id mon_id
3 1
3 2
devices table:
devices_id device_type device_name
1 comp pc_A
2 mon mon_ww
3 mon mon_wa
Now on a page I want to display every data I know of device 3 (the computer) So the devices_id of the computer from the device table is used in the url. Then I made a query to see the data for this device. However I also want to see which devices including there names and some other data stored for them (also) in the devices table are attached to it!
Is this possible? (First I have to get info for the device with id 3 (same as url Id) then I have to look into the table attach for the device with id 3 and see what device are attached, these are devices 1 and 2. How can I now use these ID's to show the device names (in the devices table) for both these devices on the same page?
Thank you in advance. Hopefully someone can help me and tell me if this is possible..
Gr, kabbi
I have a difficult question. I am busy building some sort of registration application. With this application it is possible to register devices. But it has also to be possible to attach device to eachoter (for instance attach a computer to one or more monitors or attach a monitor to one or more computers). Herefore I have made a database with two tables; one to register the devices (they get a unique device_id which is primary key auto_increment) and another table to attach devices.
The attach table is made of 2 colomns:
monitor_id (which is a device_id of the devices table [of the monitor attached])
and the computer_id (which is a device_id of the devices table [of the computer attached])
For instance in the devices table there are a monitor with id 2 a monitor with id 1 and a computer with id 3.
I want to attach monitor 1 and 2 to computer 3
In the attach table it would look like this:
attach table
comp_id mon_id
3 1
3 2
devices table:
devices_id device_type device_name
1 comp pc_A
2 mon mon_ww
3 mon mon_wa
Now on a page I want to display every data I know of device 3 (the computer) So the devices_id of the computer from the device table is used in the url. Then I made a query to see the data for this device. However I also want to see which devices including there names and some other data stored for them (also) in the devices table are attached to it!
Is this possible? (First I have to get info for the device with id 3 (same as url Id) then I have to look into the table attach for the device with id 3 and see what device are attached, these are devices 1 and 2. How can I now use these ID's to show the device names (in the devices table) for both these devices on the same page?
Thank you in advance. Hopefully someone can help me and tell me if this is possible..
Gr, kabbi