Tables in MySQL
Posted: Tue Dec 03, 2002 7:40 am
Hi Guys,
I'm a novice at PHP/MySQL and would appreciate any help I can get...
Lets say I have 2 tables:
Table 1: Category
Category | CategoryId
-----------------------
Cakes | 1
Table 2: Items
ItemName | Category
---------------------
Chocolate | ?
My question is if I want to select a category for Table 2 that is in Table 1 how do I do it?
MySQL> INSERT INTO Items SET
-> ItemName = "Chocolate"
-> Category = ?????????
->;
I tried putting the actual word and I tried the assigned CategoryId number '1' but got an error for both...
Is there a command line to insert a field from one table into another?
One other question... I seem to have a problem with the transfer of info from the script to the database - what does it mean when I submit an entry in PHP and MySQL recognises that it is a new entry but adds a blank entry? Has anyone come across that at all? I have not been able to find out what is wrong...
Thanks for your help ...
Don_assi
I'm a novice at PHP/MySQL and would appreciate any help I can get...
Lets say I have 2 tables:
Table 1: Category
Category | CategoryId
-----------------------
Cakes | 1
Table 2: Items
ItemName | Category
---------------------
Chocolate | ?
My question is if I want to select a category for Table 2 that is in Table 1 how do I do it?
MySQL> INSERT INTO Items SET
-> ItemName = "Chocolate"
-> Category = ?????????
->;
I tried putting the actual word and I tried the assigned CategoryId number '1' but got an error for both...
Is there a command line to insert a field from one table into another?
One other question... I seem to have a problem with the transfer of info from the script to the database - what does it mean when I submit an entry in PHP and MySQL recognises that it is a new entry but adds a blank entry? Has anyone come across that at all? I have not been able to find out what is wrong...
Thanks for your help ...
Don_assi