Code: Select all
// this table is a list of the certifications available
$cert_array = @mysql_query('SELECT * FROM certs ORDER BY CERTS');
if (!$cert_array) {
die('<h2>Error retrieving certs from table!</h2><br>' .
'Error: ' . mysql_error());
}
// this table is a list of certs a member already has.
$sql_query = @mysql_query("SELECT faccerts.CID FROM faccerts, certs WHERE faccerts.FID='$fid' AND faccerts.CID=certs.ID ORDER BY CID");
if (!$sql_query) {
echo ("Error in sql query: " . mysql_error());
}
/* Here is where we begin the outer loop to check each certification with the faculty member's certifications so that only those certifications the faculty member does not have are printed
*/
while ($faccerts = mysql_fetch_array($sql_query)) {
mysql_fetch_array($cert_array);
while ($certs = mysql_fetch_array($cert_array)) {
if ($certs[0] == $faccerts[0]) {
unset($certs[1]);
}
} // This array is not getting reset back to the top. How do I do this?
} // This ends the loop to check for certifications already held by member.
//Here's where we now print the certifications.
while ($certs=mysql_fetch_array($cert_array)) {
$cert = htmlspecialchars($certs[1]);
$cid = $certs[0];
echo ('<tr>
<td><input type="checkbox" name="selected[]" id="selected" value='.$cid.'></td>
<td>'.$cert.'</td></tr>');
}Thanks so much
Chris.