Page 1 of 1
Pulling off of two ID's...
Posted: Mon Jan 13, 2003 4:44 pm
by aybra
I am making a child tracking program for my wifes daycare, in it you can add all the child info, parent info blah blah blah... wich so far is going really good. How you track the child is using a field named 'childnumber'
The way I have it set up is in 5 tables,
'mi'//motherinfo
'fi'//fatherinfo
'ci'//childinfo
'contacts'//who besides the parents are allowed to pick up the child
'timesheet'//where you clock in the child and keep track of there hours.
My question is this:...
Right now using what i have set up, if one family has two children going to the daycare I have to set up four parents, one mother and father for each child, is there any way to make 'childnumber' have two numbers in it, and still be able to query them seperatly?
If i didnt make sence or you need more input let me know,
Thanks for the help
ie... I'm using My_Sql latest and greatest
Posted: Mon Jan 13, 2003 4:48 pm
by Elmseeker
Why not use one table with thoes 5 things as fields and an ID field instead? Then you could simply use multiple child fields, ie child 1, child2, child3, etc...sort of like what I use on my site, though you probably don't need all the fields I have...
Code: Select all
CREATE TABLE p_login (
ID bigint(20) NOT NULL auto_increment,
rname varchar(25) NOT NULL default '',
email varchar(100) NOT NULL default '',
u_name varchar(25) NOT NULL default '',
u_pass varchar(32) NOT NULL default '',
kid0 bigint(20) NOT NULL default '0',
kid1 bigint(20) NOT NULL default '0',
kid2 bigint(20) NOT NULL default '0',
kid3 bigint(20) NOT NULL default '0',
kid4 bigint(20) NOT NULL default '0',
kid5 bigint(20) NOT NULL default '0',
kid6 bigint(20) NOT NULL default '0',
kid7 bigint(20) NOT NULL default '0',
kid8 bigint(20) NOT NULL default '0',
kid9 bigint(20) NOT NULL default '0',
u_level tinyint(4) NOT NULL default '0',
PRIMARY KEY (ID),
UNIQUE KEY u_name (u_name),
UNIQUE KEY kid0 (kid0),
UNIQUE KEY kid1 (kid1),
UNIQUE KEY kid2 (kid2),
UNIQUE KEY kid3 (kid3),
UNIQUE KEY kid4 (kid4),
UNIQUE KEY kid5 (kid5),
UNIQUE KEY kid6 (kid6),
UNIQUE KEY kid7 (kid7),
UNIQUE KEY kid8 (kid8),
UNIQUE KEY kid9 (kid9),
UNIQUE KEY ID_2 (ID),
KEY ID (ID)
) TYPE=MyISAM;
Hope this helps!
Posted: Mon Jan 13, 2003 5:05 pm
by aybra
Maybe a table structure will help.
Code: Select all
#
# Table structure for table `ci`
#
CREATE TABLE ci (
childnumber varchar(6) NOT NULL default '',
cname tinytext NOT NULL,
cschool longtext NOT NULL,
birthday longtext NOT NULL,
class tinytext NOT NULL,
points tinyint(1) NOT NULL default '0',
enroll date NOT NULL default '0000-00-00',
leave date NOT NULL default '0000-00-00'
) TYPE=MyISAM;
# --------------------------------------------------------
#
# Table structure for table `contacts`
#
CREATE TABLE contacts (
childnumberc varchar(6) NOT NULL default '',
name tinytext NOT NULL,
number tinytext NOT NULL,
relation tinytext NOT NULL
) TYPE=MyISAM;
# --------------------------------------------------------
#
# Table structure for table `fi`
#
CREATE TABLE fi (
childnumberf varchar(6) NOT NULL default '',
fname tinytext NOT NULL,
fphone tinytext NOT NULL,
fwphone tinytext NOT NULL,
fwork longtext NOT NULL,
faddress longtext NOT NULL,
fcell tinytext NOT NULL,
fss tinytext NOT NULL
) TYPE=MyISAM;
# --------------------------------------------------------
#
# Table structure for table `mi`
#
CREATE TABLE mi (
childnumberm varchar(6) NOT NULL default '',
mname tinytext NOT NULL,
mphone tinytext NOT NULL,
mwphone tinytext NOT NULL,
mwork longtext NOT NULL,
maddress longtext NOT NULL,
mcell tinytext NOT NULL,
mss tinytext NOT NULL
) TYPE=MyISAM;
# --------------------------------------------------------
#
# Table structure for table `timesheet`
#
CREATE TABLE timesheet (
ID tinyint(3) unsigned zerofill NOT NULL auto_increment,
childnumbert varchar(6) NOT NULL default '',
timein time NOT NULL default '00:00:00',
timeout time NOT NULL default '00:00:00',
logged tinyint(1) unsigned zerofill NOT NULL default '0',
PRIMARY KEY (ID,childnumbert)
) TYPE=MyISAM;