Witam
Napisałem skrypt który działa ale tylko do SELECT w instrukcji foreach (kod który się nie wykonuje zaznaczyłem /*):
<?php
include '../includes/common.inc.php';
include '../includes/klasy.inc.php';
include '../includes/students.inc.php';
include '../includes/oceny.inc.php';
require_group(_TEACHER_GROUP);
page_header();
page_menu();
if (isset($_GET['success'])) { if ($_GET['success'] == 1
) { $success = 'Oceny zapisano pomyślnie.'; } } ?>
<div id="content">
<h2>Oceny</h2>
<div id="breadcrumb"><a href="<?=$conf_settings['site_url']?>">Strona główna</a> -> <em>Oceny</em></div>
<?php if ($success) echo "<strong class=\"success\">$success</strong>"; ?>
<div style="clear: both;"></div>
<p>Witaj w systemie ocen. Tutaj możesz dodawać oceny, przeglądać i edytować oceny. Wybirz klasę i przedmiot w której zamierzasz wykonać te operacje.</p>
<?php
if (authUserInGroup($_SESSION['username'], _TEACHER_GROUP)) { $classlist = classGetClassesByCreator($_SESSION['username']); // get array of classes since the beginning of time
} elseif (authUserInGroup($_SESSION['username'], _ADMIN_GROUP)) { $classlist = classGetClassesAfterTime(0); }
if (empty($classlist)) { // no classes ?>
W tej chwili nie ma dostępnych klas. Kliknij tutaj aby <a href="/klasy/new.php">utworzyć nową klasę</a>.
<?php
} else {
?>
<div style="float: left;">
<p>Wybierz przedmiot:</p>
<p>
<?php
if (!empty($classlist)) { ?>
<table cellpadding=5 class="classlist">
<tr><th>Nazwa</th><th>Przedmioty Klasy</th></tr>
<?php
$i = 0;
foreach ($classlist as $class)
{
$i++;
if ($i % 2)
echo '<tr class="even">'; else
echo '<td rowspan="15">' . $class['name'] . '</a></td>';
/*
$przedmiotlist = "SELECT * FROM `intra_classlesson` WHERE `classid` = '" .$classid. "' ";
if ($numToGet) { $przedmiotlist.='LIMIT $start, $numToGet'; }
$result=mysql_query($przedmiotlist) or die(mysql_error());
$return=array();
while ($row=mysql_fetch_assoc($result)) { $return[]=$row; } return $return;
if (!empty($przedmiotlist)) {
echo "<pre>".print_r($przedmiotlist, true)."</pre>";
$i = 0;
foreach ($przedmiotlist as $przedmiot)
{
$i++;
$przedmiotinfo = ' SELECT lessonname FROM intra_lesson WHERE id="' .$przedmiot['przedmiotid'].'" ';
$result=mysql_query($przedmiotinfo) or die(mysql_error());
return mysql_fetch_assoc($result);
if ($i % 2) echo '<tr class="even">'; else echo '<tr class="odd">';
echo '<td><a href="/oceny/do.php?classid='.$id.'&przedmiotid=' . $przedmiot['przedmiotid'] . '">'.$przedmiotinfo['lessonname'].'</a></td>';
echo '</tr>';
echo "\n";
}
} else {
?><td>
W tej chwili nie ma przedmiotów w tej klasie. Tutaj możesz <a href="addprzedmiot.php">dodać przedmiot do tej klasy</a>.</td>
<?php
}
*/
}
}else {
?><td colspan="2">
W tej chwili nie ma klas w bazie danych. Tutaj możesz <a href="newclass.php">utworzyć nową klasę</a>.</td>
<?php
}
?>
</p>
<div style="clear: both;"></div>
<?php
}
?>
</div> <!-- content -->
<?php
page_footer();
?>
Co zrobiłem nie tak i dlaczego ten fragment kodu nie może sie wykonać? Bardzo proszę o pomoc.