Hello.
I have a query on how to perform this task.
I have two tables,
CREATE TABLE IF NOT EXISTS login
(
LoginId
int(11) NOT NULL AUTO_INCREMENT,
Name
varchar(50) DEFAULT NULL,
Password
varchar(50) DEFAULT NULL,
Department
varchar(100) DEFAULT NULL,
PRIMARY KEY (
LoginId
)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;
and
CREATE TABLE IF NOT EXISTS dailylogwork
(
DailyLogWorkId
int(11) NOT NULL AUTO_INCREMENT,
Department
varchar(100) DEFAULT NULL,
Date
date NOT NULL,
WorkDone
longtext,
Location
int(20) NOT NULL,
Equipment
int(20) NOT NULL,
User
varchar(50) DEFAULT NULL,
PRIMARY KEY (
DailyLogWorkId
)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=13 ;
The user is added to the system by the system admin, and is assigned to a Department, so the login field wil be like this
INSERT INTO login
(LoginId
, Name
, Password
, Department
) VALUES
(1, 'P.BROWN', 'hollie', 'ELECTRONIC'),
(4, 'A.GREY', '1234', 'ELECTRICAL'),
(5, 'D.BLACK', '1234', 'ELECTRONIC');
When these users go to the dailyworklog and add new, the field User is occupied using $_SESSION["UserID"]
But, I also need the field Department to be automatically occupied to the correct department.
Can anybody please show me how I can do this?
I have tried using the lookup wizard, but it wont work.
Many thanks
Paul