
Originally Posted by
windowsxp
if input = -1 which means all students .. then I want to select all students
if input = studentId then I want to select that specific student only.
the solution i provided gives you exactly that
perhaps you were confused because i did not post the entire query, so here you go --
Code:
SELECT ...
FROM ...
WHERE studentid = $input
OR -1 = $input
i don't care whether you use jsp or c-flat or whatever language, but you ~must~ feed the value of the input number (which you said was going to be either a studentid or -1) into the query somehow, and in the solution i gave you, that would be $input, which perhaps confused you because it looks like a php variable
this solution ~is~ in "the DB tier"
this solution ~is~ in the WHERE clause
please, give it a try before you say i didn't understand your requirements
Bookmarks