DB_FormBuilder
| From: | David Thunman | Date: | Tue, 16 Mar 2004 13:08:12 +0000 |
| Subject: | DB_FormBuilder | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-11321@lists.php.net to get a copy of this message | ||
Hi,
I have some problems to understand how to realize a working logic for related tables in situations like the following sql schema:
CREATE TABLE measure (
measure_id int(11) NOT NULL auto_increment,
measuretype_ID_ID int(11) NOT NULL,
client_ID int(11) NOT NULL,
title VARCHAR(96) NOT NULL default '',
info TEXT,
date_lastedit datetime NOT NULL,
date_created datetime NOT NULL,
PRIMARY KEY (measure_id),
KEY client_ID (client_ID),
KEY measuretype_ID (measuretype_ID),
) TYPE=MyISAM;
CREATE TABLE photos (
photo_id int(11) NOT NULL auto_increment,
file_ID int(11) NOT NULL,
measure_ID int(11) NOT NULL,
PRIMARY KEY (photo_id),
KEY file_ID (file_ID),
KEY measure_ID (measure_ID)
) TYPE=MyISAM;
CREATE TABLE file (
file_id int(11) NOT NULL auto_increment,
title varchar(64) NOT NULL default '',
mime varchar(12) default NULL,
size varchar(32) default NULL,
width varchar(6) default NULL,
height varchar(6) default NULL,
date_lastedit datetime NOT NULL,
PRIMARY KEY (file_id)
) TYPE=MyISAM;
The flow is so that each item in table "measure" will have a file form field where I want to upload a file and then insert the file data into the "file" table. Then I use the "photos" table for the relation between the "measure" and "file" table.
The problem is how to implement this in my FormBuilder Measure Class when I create the form. Is it possible for the FormBuilder to recognize such a relation from within the Measure Class, or do I have to create an instance of the File Class in the Measure Class.
Sorry for this confusion, but I am a bit stuck here.
Thanks,
David Thunman