HTML interesse |
|
Nee nee.. ik heb iets anders.. ik heb ruim 90% informatie weggelaten.. maar hierdoor laait nu deze discussie.. hieronder een stukje van mijn code die eerst deze warning gaf:
<?php
$per1 = mysql_fetch_object(mysql_query("SELECT activeren FROM " . TBL_CCONTROL . " WHERE periode = 1"));
if($per1->activeren) {
$sqlc = mysql_query("SELECT ROUND(SUM(cijfer * weging) / SUM(weging),1) AS gem1 FROM " . TBL_CIJFERS . " WHERE ll = '".$sqla['id']."' AND rapport = '1' GROUP BY ll AND rapport = '1'");
if(mysql_num_rows($sqlc)) {
$resc = mysql_fetch_object($sqlc);
echo '<div id="text"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="50%">Het gemiddelde cijfer voor periode 1 is: </td>';
echo '<td width="15%"><strong>' . $resc->gem1 . '</strong></td>';
echo '<td width="35%">1x</td></tr></table></div>';
}
}
$per2 = mysql_fetch_object(mysql_query("SELECT activeren FROM " . TBL_CCONTROL . " WHERE periode = 2"));
if($per2->activeren) {
$sqld = mysql_query("SELECT ROUND(SUM(cijfer * weging) / SUM(weging),1) AS gem2 FROM " . TBL_CIJFERS . " WHERE ll = '".$sqla['id']."' AND rapport = '2' GROUP BY ll AND rapport = '2'");
if(mysql_num_rows($sqld)) {
$resd = mysql_fetch_object($sqld);
echo '<div id="text"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="50%">Het gemiddelde cijfer voor periode 2 is: </td>';
echo '<td width="15%"><strong>' . $resd->gem2 . '</strong></td>';
echo '<td width="35%">1x</td></tr></table></div>';
}
}
$per3 = mysql_fetch_object(mysql_query("SELECT activeren FROM " . TBL_CCONTROL . " WHERE periode = 3"));
if($per3->activeren) {
$sqle = mysql_query("SELECT ROUND(SUM(cijfer * weging) / SUM(weging),1) AS gem3 FROM " . TBL_CIJFERS . " WHERE ll = '".$sqla['id']."' AND rapport = '3' GROUP BY ll AND rapport = '3'");
if(mysql_num_rows($sqle)) {
$rese = mysql_fetch_object($sqle);
echo '<div id="text"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="50%">Het gemiddelde cijfer voor periode 3 is: </td>';
echo '<td width="15%"><strong>' . $rese->gem3 . '</strong></td>';
echo '<td width="35%">1x</td></tr></table></div>';
}
}
$per4 = mysql_fetch_object(mysql_query("SELECT activeren FROM " . TBL_CCONTROL . " WHERE periode = 4"));
if($per4->activeren) {
$sqlf = mysql_query("SELECT ROUND(SUM(cijfer * weging) / SUM(weging),1) AS gem4 FROM " . TBL_CIJFERS . " WHERE ll = '".$sqla['id']."' AND rapport = '4' GROUP BY ll AND rapport = '4'");
if(mysql_num_rows($sqlf)) {
$resf = mysql_fetch_object($sqlf);
echo '<div id="text"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="50%">Het gemiddelde cijfer voor periode 4 is: </td>';
echo '<td width="15%"><strong>' . $resf->gem4 . '</strong></td>';
echo '<td width="35%">2x</td></tr></table></div>';
}
}
$eind = mysql_fetch_object(mysql_query("SELECT activeren FROM " . TBL_CCONTROL . " WHERE periode = 5"));
if($eind->activeren) {
if(mysql_num_rows($sqlc) && mysql_num_rows($sqld) && mysql_num_rows($sqle) && mysql_num_rows($sqlf)) {
echo '<hr class="line" />';
$eindcijfer = (($resc->gem1 + $resd->gem2 + $rese->gem3 + $resf->gem4 + $resf->gem4) / 5);
echo '<div id="text"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="50%">Het eindcijfer is: </td>';
echo '<td width="50%"><strong>' . $eindcijfer . '</strong></td></tr></table></div>';
echo '<div id="text"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="50%">Het afgeronde eindcijfer is: </td>';
echo '<td width="50%"><strong>' . round($eindcijfer, 0) . '</strong></td></tr></table></div>';
}
}
?>
<?php if($per1->activeren) { $sqlc = mysql_query("SELECT ROUND(SUM(cijfer * weging) / SUM(weging),1) AS gem1 FROM " . TBL_CIJFERS . " WHERE ll = '".$sqla['id']."' AND rapport = '1' GROUP BY ll AND rapport = '1'"); echo '<div id="text"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="50%">Het gemiddelde cijfer voor periode 1 is: </td>'; echo '<td width="15%"><strong>' . $resc->gem1 . '</strong></td>'; echo '<td width="35%">1x</td></tr></table></div>'; } } if($per2->activeren) { $sqld = mysql_query("SELECT ROUND(SUM(cijfer * weging) / SUM(weging),1) AS gem2 FROM " . TBL_CIJFERS . " WHERE ll = '".$sqla['id']."' AND rapport = '2' GROUP BY ll AND rapport = '2'"); echo '<div id="text"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="50%">Het gemiddelde cijfer voor periode 2 is: </td>'; echo '<td width="15%"><strong>' . $resd->gem2 . '</strong></td>'; echo '<td width="35%">1x</td></tr></table></div>'; } } if($per3->activeren) { $sqle = mysql_query("SELECT ROUND(SUM(cijfer * weging) / SUM(weging),1) AS gem3 FROM " . TBL_CIJFERS . " WHERE ll = '".$sqla['id']."' AND rapport = '3' GROUP BY ll AND rapport = '3'"); echo '<div id="text"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="50%">Het gemiddelde cijfer voor periode 3 is: </td>'; echo '<td width="15%"><strong>' . $rese->gem3 . '</strong></td>'; echo '<td width="35%">1x</td></tr></table></div>'; } } if($per4->activeren) { $sqlf = mysql_query("SELECT ROUND(SUM(cijfer * weging) / SUM(weging),1) AS gem4 FROM " . TBL_CIJFERS . " WHERE ll = '".$sqla['id']."' AND rapport = '4' GROUP BY ll AND rapport = '4'"); echo '<div id="text"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="50%">Het gemiddelde cijfer voor periode 4 is: </td>'; echo '<td width="15%"><strong>' . $resf->gem4 . '</strong></td>'; echo '<td width="35%">2x</td></tr></table></div>'; } } if($eind->activeren) { echo '<hr class="line" />'; $eindcijfer = (($resc->gem1 + $resd->gem2 + $rese->gem3 + $resf->gem4 + $resf->gem4) / 5); echo '<div id="text"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="50%">Het eindcijfer is: </td>'; echo '<td width="50%"><strong>' . $eindcijfer . '</strong></td></tr></table></div>'; echo '<div id="text"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="50%">Het afgeronde eindcijfer is: </td>'; echo '<td width="50%"><strong>' . round($eindcijfer, 0) . '</strong></td></tr></table></div>'; } } ?>
Onderin staat die in-het-verleden-gemaakte foutmelding:
if(mysql_num_rows($sqlc) && mysql_num_rows($sqld) && mysql_num_rows($sqle) && mysql_num_rows($sqlf)) {
Maar de foutmelding kwam omdat:
$sqlc = mysql_query("SELECT ROUND(SUM(cijfer * weging) / SUM(weging),1) AS gem1 FROM " . TBL_CIJFERS . " WHERE ll = '".$sqla['id']."' AND rapport = '1' GROUP BY ll AND rapport = '1'");
$sqlc = mysql_query("SELECT ROUND(SUM(cijfer * weging) / SUM(weging),1) AS gem1 FROM " . TBL_CIJFERS . " WHERE ll = '".$sqla['id']."' AND rapport = '1' GROUP BY ll AND rapport = '1'");
+ idem voor $sqld/e en f
... kwam omdat deze nog in de if(); stond van:
+ idem voor per2/3/4
Deze kan je met checkboxjes aan en uitvinken. Als alle 4 uitgevinkt staat is het dus 0 en wordt de if niet meer gelezen en kan hij die querie ook niet meer zin, vandaar die foutmelding.
Kan zijn dat ik het vaag uitleg, maar denk dat het te begrijpen valt. En waarschijnlijk is mijn code ook niet zo netjes geprogrammeerd |