A pretty simple issue. I need to check and varify the value of multiple records in a query. I may have 2 or 3 records or as many as 18 in a query. I need to check the value of a field called status. Either 0 or 1.
0 = not complete.
1 = complete.
My first attempt:
I pass the value of Course_ID to the page, then run the query.
$Course_ID = $_GET['Course_ID'];
$getcourseinfo = $db->sql_query("SELECT status FROM ".$prefix."_tl_session WHERE Course_ID = '$Course_ID'");
while($row = $db->sql_fetchrow($getcourseinfo)) {
$status = $row[status];
if ($status == 0) {
echo"<tr><td>Status Check confirms all TL sessions are not complete.</td></tr>";
}else {
echo"<tr><td>Status Check confirms all TL sessions have been completed.</td></tr>";
}
}
This is just some simple error checking to make sure all sessions are complete and status is "checked" before I continue.
In my example I had three records in the query with the 2nd one having a value of 0, so I returned:
Status Check confirms all TL sessions have been completed.Status Check confirms all TL sessions are not complete.Status Check confirms all TL sessions have been completed.
Not really what I wanted.
Maybe I should not use a while loop. I need to verify the status of each record.