[PHP] problem with multiple fields

2005-05-19 Thread Vinss
sorry for my poor english, i'll try to be understood
 so i want to represent an informatic parc but have a problem
 for example a pc can have 2 or more memory slot filled how to stock 
the different id in a list in my database and how extract it
for the moment i just have an external key referencing one memory.
 Have you an idea to help me please?


Re: [PHP] problem with multiple fields

2005-05-19 Thread Tom Rogers
Hi,

Thursday, May 19, 2005, 6:07:53 PM, you wrote:
V sorry for my poor english, i'll try to be understood
V  so i want to represent an informatic parc but have a problem
V  for example a pc can have 2 or more memory slot filled how to stock
V the different id in a list in my database and how extract it
V for the moment i just have an external key referencing one memory.
V  Have you an idea to help me please?

It is probably best to put the individual items in a separate table
and link their keys, as an example with 3 tables

table items
itemid
name

table item_list
pcid
itemid

table pc
pcid
location


then these could contain
items
itemid  name
1   memory module
2   floppy drive

pc
pcid location
1reception

item_list
pcid itemid
11
11
12

so reception pc contains 2 memory modules and 1 floppy

Hope that helps

-- 
regards,
Tom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] problem with multiple fields

2005-05-19 Thread Vinss
but in fact for example:
pc reception have two memory module but i do the gestion of the individual 
pieces too
 for example in a table i have
 id name ref hs? 
1 sdram256 22055 True 
2 sdrram512 22056 True
 so i need to keep the informations of the reference too 


2005/5/19, Tom Rogers [EMAIL PROTECTED]: 
 
 Hi,
 
 Thursday, May 19, 2005, 6:07:53 PM, you wrote:
 V sorry for my poor english, i'll try to be understood
 V so i want to represent an informatic parc but have a problem
 V for example a pc can have 2 or more memory slot filled how to stock
 V the different id in a list in my database and how extract it
 V for the moment i just have an external key referencing one memory.
 V Have you an idea to help me please?
 
 It is probably best to put the individual items in a separate table
 and link their keys, as an example with 3 tables
 
 table items
 itemid
 name
 
 table item_list
 pcid
 itemid
 
 table pc
 pcid
 location
 
 then these could contain
 items
 itemid name
 1 memory module
 2 floppy drive
 
 pc
 pcid location
 1 reception
 
 item_list
 pcid itemid
 1 1
 1 1
 1 2
 
 so reception pc contains 2 memory modules and 1 floppy
 
 Hope that helps
 
 --
 regards,
 Tom
 
 


-- 
Ne sois pas trop prompt en parole réfléchis
aux conséquences de tes mots.
Derrière un pc il y a toujours un humain


Re: [PHP] problem with multiple fields

2005-05-19 Thread Vinss
but don't worry it helps a bit just i don't see how to keep this ref.

2005/5/19, Vinss [EMAIL PROTECTED]: 
 
 but in fact for example:
 pc reception have two memory module but i do the gestion of the individual 
 pieces too
  for example in a table i have
  id name ref hs? 
 1 sdram256 22055 True 
 2 sdrram512 22056 True
  so i need to keep the informations of the reference too 
 
 
 2005/5/19, Tom Rogers [EMAIL PROTECTED]: 
  
  Hi,
  
  Thursday, May 19, 2005, 6:07:53 PM, you wrote:
  V sorry for my poor english, i'll try to be understood 
  V so i want to represent an informatic parc but have a problem
  V for example a pc can have 2 or more memory slot filled how to stock
  V the different id in a list in my database and how extract it
  V for the moment i just have an external key referencing one memory.
  V Have you an idea to help me please?
  
  It is probably best to put the individual items in a separate table
  and link their keys, as an example with 3 tables 
  
  table items
  itemid
  name
  
  table item_list
  pcid
  itemid
  
  table pc
  pcid
  location
  
  then these could contain
  items
  itemid name
  1 memory module
  2 floppy drive
  
  pc
  pcid location
  1 reception
  
  item_list
  pcid itemid
  1 1
  1 1
  1 2
  
  so reception pc contains 2 memory modules and 1 floppy
  
  Hope that helps
  
  --
  regards,
  Tom
  
  
 
 
 -- 
 Ne sois pas trop prompt en parole réfléchis
 aux conséquences de tes mots.
 Derrière un pc il y a toujours un humain 




-- 
Ne sois pas trop prompt en parole réfléchis
aux conséquences de tes mots.
Derrière un pc il y a toujours un humain


Re[2]: [PHP] problem with multiple fields

2005-05-19 Thread Tom Rogers
Hi,

Thursday, May 19, 2005, 8:12:45 PM, you wrote:
V but in fact for example:
V pc reception have two memory module but i do the gestion of the individual
V pieces too
V  for example in a table i have
V  id name ref hs? 
V 1 sdram256 22055 True 
V 2 sdrram512 22056 True
V  so i need to keep the informations of the reference too 


V 2005/5/19, Tom Rogers [EMAIL PROTECTED]: 


In that case use the reference as the key to the item

id name hs
22055 sdram256 true
22056 sdram512 true

then the item list table would be

pc id
1  22055
1  22056

--
regards,
Tom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php