i am relatively new in phpmysql.i need some help...
i am using wamp server in windows7.server version is 2.2.22 and php version is 5.3.13.Name of my database is db_attendance1
. I have two table namely users
and leave
.In users table i have following column
empID(int)
username(varchar)
password(varchar)
mac(varchar)
ip(varchar)
and in leave table i have following column
lid(int)
empname(varchar)
username(varchar)
nod(int)
sdate(date)
edate(date)
reason(varchar)
action(varchar)
Now i want to use empID in leave table.how can i use it.i have to say that i already apply a code but its not working.Its giving the following error..
1005 - Can't create table 'db_attendance1.leave' (errno: 150) (Details...)
and in details its showing the following..
InnoDB Documentation
Supports transactions, row-level locking, and foreign keys
[ Variables | Buffer Pool | InnoDB Status ]
and the code
create table `leave`(
lid INT NOT NULL AUTO_INCREMENT,
empID INT,
empname VARCHAR(255) NOT NULL,
username VARCHAR(255) NOT NULL,
nod INT NOT NULL,
sdate DATE,
edate DATE,
reason VARCHAR(255) NOT NULL,
PRIMARY KEY(lid),
FOREIGN KEY(empID) REFERENCES users(empID)
);
so whats wrong...please help me..