I have a page where appear a list of alumns registered to a class, above a textbox for write a name of an alumn and right side a button submit for execute the search, these textobox is for search alumns in bd that still aren't registered to that class.
When I search a alumn and I registered to class, update the page, but when I make a new search still appear the alumn that I registered before.
I thought use this query (in php)
$q = "select * from studentsubject where studid=$studid and classid=$classid";
$r = mysql_query($q);
These query show the alumns are registered to the class, then I want do adverse, show the list of alumns that still aren't registered to the class and hide the alumns that already are registered.
I try with stored procedure:
DELIMITER $$
CREATE PROCEDURE getStudents(in classid_val int(11), in studid_val int(11))
BEGIN
SELECT * from studentsubject WHERE classid=classid_val AND studid=studid_val
SELECT FOUND_ROWS()
IF FOUND_ROWS()>0 THEN
select * from student where id=studid_val
ELSEIF FOUND_ROWS()<0 THEN
select * from student
ENDIF;
END$$
These stored procedure do 1/2 of I want do, but it don't work when I make a search by name of alumns with the textbox that befored told.