Ok I did not see this anywhere in the docs… how does one dynamically alter a Select statement.
Lets say I have a grid of students.
I have schoolid set as a global variable.
I also have sec_level and [teacherid] set as global variables.
What I want to do is this:
$add_sql = “”;
$teacherid = [teacherid];
$sec_level = [sec_level];
if ( $sec_level == 6 ) //this is a teacher that logged in
{
$add_sql = " AND teacher = ‘$teacherid’ ";
}
$sql=" Select * from student_table WHERE schoolid = [schoolid] ";
$sql.= $add_sql;
Where do I place this code? OnScriptInit?