Hi
As most here I am working on stuff. This is my first app and database from the ground up. Now to the point
I have created the following tables to manage an art portfolio. For each piece there will be one "port_inventory" entry, there can be multiple "port_images" and "port_text" entries that relate to "port_inventory" (tables at end of post). When creating the tables I set invID in "port_inventory" as primary, in the other two tables I used invID and txtID or imgID as the primary key. In the tables images and text I did not set the primary key's to auto_increment, invID if it autos it will be different the the inv it is supposed to reference, the other two I did not so I could now how many instances were for each invID ( I was hoping for a primary key result like invID 1 txtID 1, invID 1 txtId 2 and so on)
I one problem and another question.
Question, is the way I have this a good idea? Or is there a better option for what I have done.
The problem, I can add data to any of the tables, I am having problems when it comes to UPDATE of the fields here is the code I am using
$sql = "UPDATE port_images SET
full='$full',large='$large',medium='$medium',small='$small',invID='$invID'
WHERE imgID=$id";
I dont know how to choose multipe $id's, when I run this as I have it, it returns the form but with empty fields, and if I change the data, nothing is updated.
CREATE TABLE port_images (
invID int(10) NOT NULL default '0',
imgID int(10) NOT NULL default '0',
full varchar(255) default NULL,
large varchar(255) default NULL,
medium varchar(255) default NULL,
small varchar(255) default NULL,
PRIMARY KEY (invID,imgID)
CREATE TABLE port_inventory (
authID int(10) NOT NULL default '0',
invID int(10) NOT NULL auto_increment,
artist varchar(100) default NULL,
title varchar(255) default NULL,
medium varchar(255) default NULL,
year year(4) default NULL,
date date NOT NULL default '0000-00-00',
sizeH char(3) default NULL,
sizeW char(3) default NULL,
PRIMARY KEY (invID)
CREATE TABLE port_text (
invID int(10) NOT NULL default '0',
txtID int(10) NOT NULL default '0',
text text,
who varchar(255) default NULL,
what varchar(255) default NULL,
where varchar(255) default NULL,
when varchar(255) default NULL,
PRIMARY KEY (invID,txtID)
I am sure there are many obvious errors, but I am dense.
Many thanks.