Hi, I have another problem with this B****y database I am trying to build
My apologies if this is the same question as my other post here.
Here are the table structures
CREATE TABLE `staff` (
`userid` int(11) NOT NULL auto_increment,
`pcs_ac` varchar(15) default NULL,
`firstname` varchar(30) default NULL,
`lastname` varchar(30) default NULL,
`level` int(11) default NULL,
`Responsibility` int(11) default NULL,
`Department` varchar(50) default NULL,
PRIMARY KEY (`userid`),
KEY `id` (`userid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `detentions` (
`ID` int(11) NOT NULL auto_increment,
`DateGiven` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`TimeGiven` datetime default NULL,
`detainee` int(11) NOT NULL,
`donor` int(11) default NULL,
`TutorGroup` varchar(3) default NULL,
`DayForDetention` datetime NOT NULL,
`sess` int(11) NOT NULL,
`Lunchtime` varchar(1) default NULL,
`Done` tinyint(4) default NULL,
`reason` int(11) default NULL,
`Origin` int(11) default NULL,
`MoveToDept` datetime default NULL,
`DeptHead` int(11) default NULL,
`ReasonForDept` int(11) default NULL,
`OriginalDate` datetime default NULL,
`DoneAtDept` tinyint(4) default NULL,
`MovedToAfterSchool` datetime default NULL,
PRIMARY KEY (`detainee`,`DayForDetention`,`sess`),
UNIQUE KEY `ID` (`ID`),
KEY `Lunchtime` (`Lunchtime`),
KEY `To` (`detainee`),
KEY `TutorGroup` (`TutorGroup`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
As a temp measure while I am developing the application, i have used the staff table to act as the login table, so the login name is stored in`pcs_ac`. Just to keep things easy for testing, I have set the password field for the login screen to be equal to the `lastname` field. Once the system is up and tested, I shall get the login to use LDAP and get the user privelidges from the staff table.
The Link between the detentions table and the staff table is from `userid` in the staff table and `donor` in the detentions table.
In the Add Record form, I have the value of the `donor` set to "@$_SESSION["OwnerID"]". This gives me the login name of the staff member, I need the userID of that staff member to store in the detentions table,
How do I do this?