[FX.php List] "Portal" within a "Portal"?
Joel Shapiro
jsfmp at earthlink.net
Wed Jul 13 20:40:21 MDT 2005
Hi all
I'm getting better with this, but I'm stuck right now on getting a
"portal" within a "portal". This is a school report card project, and
I'd like to have a table that shows all of a student's marks separated
by subject. Subjects vary per grade, and each Mark record contains the
subject as well as the student_ID. I can display:
- All subjects per the student's grade, and
- All marks per student,
but when I try to combine them, I can't get the php to 'stop' at each
subject -- instead, I only pull the marks for the last subject for that
student -- even though a print_r shows that the correct subject is in
each row.
Can anyone give a tip as to what I'm doing wrong?
Thanks,
-Joel
(I've posted my whole page below. Apologies if that's not how this is
done on this list.)
<?php
include_once('FX/FX.php');
include_once('FX/server_data.php');
include_once('FX/FMErrors.php');
$recid=$_GET['recid'];
// THE FOUND STUDENT
$findstudent=new FX($serverIP,$webCompanionPort);
$findstudent->SetDBData('school.fp7','Student');
$findstudent->SetDBPassword('','Admin');
$findstudent->AddDBParam('-recid',$recid);
$studentResult=$findstudent->FMFind();
foreach($studentResult['data'] as $key=>$studentData)
// ALL SUBJECTS PER STUDENT'S GRADE
$findsubject=new FX($serverIP,$webCompanionPort);
$findsubject->SetDBData('school.fp7','Subject');
$findsubject->SetDBPassword('','Admin');
$findsubject->AddDBParam('Grade',$studentData['Grade'][0]);
$subjectResult=$findsubject->FMFind();
foreach($subjectResult['data'] as $key2=>$subjectData)
// ALL MARKS PER STUDENT
$findmark=new FX($serverIP,$webCompanionPort);
$findmark->SetDBData('school.fp7','Mark');
$findmark->SetDBPassword('','Admin');
$findmark->AddDBParam('Student_ID',$studentData['Student_ID'][0]);
$markResult=$findmark->FMFind();
// ** PROBLEM: SHOULD BE MARKS PER SUBJECT PER STUDENT **
$search2=new FX($serverIP,$webCompanionPort);
$search2->SetDBData('school.fp7','Mark');
$search2->SetDBPassword('','Admin');
$search2->AddDBParam('Student_ID',$studentData['Student_ID'][0]);
$search2->AddDBParam('Subject',$subjectData['Subject'][0]);
$search2Result=$search2->FMFind();
?>
<html>
<head>
<title>School</title>
</head>
<body>
<B><?php echo $studentData['Name'][0]; ?></B> Grade: <?php echo
$studentData['Grade'][0]; ?><BR>
** ALL SUBJECTS PER STUDENT'S GRADE **
<table border="1" cellpadding="2" cellspacing="0"
bordercolor="#999999">
<tr>
<td>Subjects for Grade <?php echo $studentData['Grade'][0]; ?></td>
</tr>
<?php foreach($subjectResult['data'] as $key=>$subjectData) { ?>
<tr>
<td><?php echo $subjectData['Subject'][0]; ?></td>
</tr>
<?php } ?>
</table><BR>
** ALL MARKS PER STUDENT **
<table border="1" cellpadding="2" cellspacing="0"
bordercolor="#999999">
<tr>
<td>Mark_ID</td>
<td>Mark</td>
<td>Subject</td>
<td>Student_ID</td>
</tr>
<?php foreach($markResult['data'] as $key=>$markData) { ?>
<tr>
<td><?php echo $markData['Mark_ID'][0]; ?></td>
<td><?php echo $markData['Mark'][0]; ?></td>
<td><?php echo $markData['Subject'][0]; ?></td>
<td><?php echo $markData['Student_ID'][0]; ?></td>
</tr>
<?php } ?>
</table><BR>
** PROBLEM: ALL MARKS PER PER SUBJECT PER STUDENT **
<table border="1" cellpadding="2" cellspacing="0"
bordercolor="#999999">
<tr>
<td>Subjects for Grade <?php echo $studentData['Grade'][0]; ?></td>
</tr>
<?php foreach($subjectResult['data'] as $key=>$subjectData) { ?>
<tr>
<td><?php echo $subjectData['Subject'][0]; ?></td>
</tr>
<!-- **** PROBLEM: Only pulls last Subject in array, not one ForEach
**** -->
<?php foreach($search2Result['data'] as $key=>$search2Data) { ?>
<tr>
<td>
<?php print_r ($subjectData['Subject'][0]); ?><BR>
<?php echo $search2Data['Mark_ID'][0]; ?>
</td>
<td><?php echo $search2Data['Mark'][0]; ?></td>
<td><?php echo $search2Data['Subject'][0]; ?></td>
<td><?php echo $search2Data['Student_ID'][0]; ?></td>
</tr>
<?php } ?>
<!-- **** END PROBLEM **** -->
<?php } ?>
</table>
</body>
</html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 11771 bytes
Desc: not available
Url : http://www.iviking.org/pipermail/fx.php_list/attachments/20050713/73184f82/attachment.bin
More information about the FX.php_List
mailing list