lvalverdeb
Posts: 299
|
Posted: 05/28/2009, 11:36 AM |
|
Try:
$db = new clsDBportfolio();
$where = "student_scores.stu_id=".CCGetUserID() ." AND course_cp_index=".$course_cp_course_semester->course_cp_index->GetValue().
" AND crssem_index=".$course_cp_course_semester->crssem_index->GetValue();
$result = CCDLookUp("count(*)", "students_scores",$where, $db);
$course_cp_course_semester->scoresavailable->Visible = $result;
FYI, the reason you're getting 1 in result is because $db->next_record is returning true because the recordset is not null. For your code to work you'd need to change it as follows:
$db = new clsDBportfolio();
$countsql="SELECT count (*) FROM student_scores WHERE student_scores.stu_id=".CCGetUserID()." AND course_cp_index=".$course_cp_course_semester->course_cp_index->GetValue().
" AND crssem_index=".$course_cp_course_semester->crssem_index->GetValue().";";
// echo $countsql;
$scorecount = $db->query($countsql);
// echo $scorecount;
$result = $db->next_record();
if ($result) {
$result = $db->f(0); // the value in the first field of the recordset.
}
// echo $result;
if ($result == 0) {
$course_cp_course_semester->scoresavailable->Visible = 0; }
$db->close();
_________________
lvalverdeb
CR, GMT-6
XAMPP/Ubuntu/CCS3.2/4 |