urgent help needed for mysql selection problem

hi people i am trying to select all userID where the userID is not in the markerID.
what happens is that when a user completes a test a userID is selected at random then assigned as the markerID this part i can do the problem is that sometimes the test is assigned to a user to be marked more than once so i need to check if that user is already marking a test.
the database code is below and below that is the query so far.


create table User
	(userID INT NOT NULL auto_increment,
	userName varchar (25),
	firstName varchar (25),
	lastName varchar (25),
	member_Type varchar (10),
	password text,
        primary key (userID));

insert into user (userName, firstName, lastName, member_Type, password)
values ("Admin", "Admin","Admin","Staff","6e13f95656485e63cd20926b74c62b97");

create table Class
	(classID INT NOT NULL auto_increment,
	className varchar (15),
	userID int,
        teacherID int,
	academicYearStart year,
	academicYearEnd year,
        primary key (classID),
	foreign key (userID) references User (userID));

create table Test
	(testID INT NOT NULL auto_increment,
	testName varchar (25),
	className varchar (15),
        questions varchar(10000),
	score varchar (100),
	answers varchar(25000) ,
	deadline varchar (12),
        primary key (testID));

create table Result
	(resultID INT NOT NULL auto_increment,
	userID int,
	testID int,
	markerID int,
	score varchar(100),
	testAnswers varchar (25000),
	flag enum ("yes","no"),
		primary key(resultID),
		foreign key (userID) references User (userID),
		foreign key (testID) references Test (testID));

[php]

// select random sudent from class to mark test
$qry = mysql_query (“SELECT * FROM Class
WHERE Class.userID != ‘$_SESSION[SESS_MEMBER_ID]’ AND Class.className =’$testClass’
ORDER BY RAND()
LIMIT 1”);

[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service