Hi guys,
currently im creating a script to view summary report for each student and their assignments.. my database look like this:
Assignment Title | Group Member | Submit Date
Title 1 John, Sue, Amir 2010-10-10
Title 2 John, Sue, Bob 2010-10-09
Title 3 Bob, Sue, Amir 2010-10-06
I've created a form for lecturer choose which student and range date to view this report... something like this:
Date Submit: from _______ to _______
Student Name: ____________(Multiple Select Box)
I want to view summary in website something like this:
Student Name | Assigment Title | Date Submitted
John Title 1 2010-10-10
Sue Title 1 2010-10-10
Amir Title 1 2010-10-10
John Title 2 2010-10-09
Sue Title 2 2010-10-09
Bob Title 2 2010-10-09
Bob Title 3 2010-10-06
Sue Title 3 2010-10-06
Amir Title 3 2010-10-06
I've created a php script to view like above summary report, but failed... i've detected the problem where my sql statement only call once for each assignments... and in my table db, all student group in one box (group member)...
my coding:
if(isset($_POST['B9'])){
$baru_satu = cleanQuery($_POST['D4']); //type of date, by submit or create
$baru_dua = cleanQuery($_POST['D5']); //From date
$baru_tiga = cleanQuery($_POST['D6']); //To date
foreach($_POST['available'] as $s) {
$q .= $s.', ';
$qtrim = strtolower($q);
$qtrim = stripslashes($q);
$qtrim = strip_tags($q);
}
$qtrim = explode(', ',$q);
foreach($qtrim as $value)
{
if($value!=NULL){
$qtrim = $qtrim."OR cag_member like '%$value%' ";
}
}
$qtrim = substr($qtrim,8);
if($baru_satu == "Submit Date"){
$masok = "submit_date";
}
if($baru_satu == "Create Date"){
$masok = "create_date";
}
//AND ".$qtrim." AND ".$qtrim0." AND ".$qtrim1
$query = "SELECT * FROM ag_info WHERE (".$qtrim.") AND ".$masok." BETWEEN '$baru_dua' AND '$baru_tiga' ";
$result = mysql_query($query);
I hope anyone can help me without changing or upgrading my database..
thank you so much..