Re: Pull data from another table
Thanks for the reply! Below are my tables, When a user puts in their Employee ID (timeUserID), information is automatically placed into the other fields related to the first table (useID: timeFirstName, timeMiddleName, timeLastName, timePhoneNumber, timeYearsActive, timeEmailAddress). I know how to do this with a query, but how may I add it intrinsically into the table?
CREATE TABLE `userInfo` (
`userID` int(4) unsigned zerofill NOT NULL AUTO_INCREMENT,
`userState` varchar(13) COLLATE utf8_unicode_ci NOT NULL,
`userEmployeeID` int(6) unsigned zerofill NOT NULL DEFAULT '000000',
`userFirstName` varchar(11) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`userMiddleName` varchar(11) COLLATE utf8_unicode_ci NOT NULL,
`userLastName` varchar(11) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`userPhoneNumber` varchar(15) COLLATE utf8_unicode_ci NOT NULL,
`userYearsActive` varchar(2) COLLATE utf8_unicode_ci NOT NULL DEFAULT '1',
`userEmailAddress` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`userID`)
) ENGINE=InnoDB AUTO_INCREMENT=1111 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE `timeLog` (
`timeID` int(4) unsigned zerofill NOT NULL AUTO_INCREMENT,
`timeTimeStamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`timeUserID` int(4) unsigned zerofill NOT NULL,
`timeFirstPunch` varchar(8) NOT NULL,
`timeSecondPunch` varchar(8) NOT NULL,
`timeNotes` text CHARACTER SET utf8 COLLATE utf8_unicode_ci,
`timeFirstName` varchar(11) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`timeMiddleName` varchar(11) COLLATE utf8_unicode_ci NOT NULL,
`timeLastName` varchar(11) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`timePhoneNumber` varchar(15) COLLATE utf8_unicode_ci NOT NULL,
`timeYearsActive` varchar(2) COLLATE utf8_unicode_ci NOT NULL DEFAULT '1',
`timeEmailAddress` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`timeID`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;