Please I need urgent help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dbnet
Forum Newbie
Posts: 2
Joined: Sun Sep 25, 2011 4:41 pm

Please I need urgent help

Post by dbnet »

with this code i have only fetched out the subjects and i need to fetch out value for the following too from the database...i have attached the template of what i want to achieve
1. GRADE
2. Contious Assessment:
3. Exam Scores:
4. Exam Scores
5. Weighted Average:
6. Last Term Cummulative:
7. Cumulative (c+d)/2:
8. Comment:
but now i can only get the foreach work for subject alone..


$l=mysql_query("SELECT * FROM result WHERE school_id='$id' AND student_reg_id='$st'") or die (mysql_error());

if (mysql_num_rows($l) > 0)
{
while ($row = mysql_fetch_array($l))
{//
$pwrlist[$row['ajax_result_id']]=$row['subject'];
//$
}
$numpwr = count($pwrlist);
$thresh = 3;
$maxcols = 18;
$cols = min($maxcols, (ceil(count($pwrlist)/$thresh)));
$percol = ceil(count($pwrlist)/$cols);
$powerchk = '';
$i = 0;
foreach ($pwrlist as $id => $pwr)
{
if (($i>0) && ($i%$percol == 0))
{
$powerchk .= "</td>\n<td valign='top'>";//echo "<br>";
}


$powerchk .= " <table width='280px' class='hovertable'>

<tr>
<td width='251px' height='34' align='left' valign='middle' bgcolor='#D6DFEB'><span class='style19'><font size=2px>$pwr</font></span></td>
<td width='19px' align='left' valign='middle' bgcolor='#D6DFEB'><span class='style1'>GRADE:</span></td>
<td width='20px' align='left' valign='middle' bgcolor='#FFFFFF'><span class='style13'>B3</span></td>
</tr>
<tr>
<td height='34' colspan='3' align='left' valign='top' bgcolor='#FFFFFF'><span class='style20'>&raquo; (a) Contious Assessment: 80<br />
&raquo; (b) Exam Scores: 90<br />
&raquo; (c) Weighted Average: 168<br />
&raquo; (d) Last Term Cummulative: 78<br />
&raquo; (e) Cumulative (c+d)/2: 123 </span></td>
</tr>
<tr>
<td height='20' colspan='3' align='left' valign='top' bgcolor='#FFFFFF'><span class='style17'>Comment: His is a responsible boy</span></td>
</tr>
</table><br>\n";
$i++;
}

}
Attachments
result Temp.png
Eric!
DevNet Resident
Posts: 1146
Joined: Sun Jun 14, 2009 3:13 pm

Re: Please I need urgent help

Post by Eric! »

You are only getting the subject because that is all you're pulling out from the returned results:

Code: Select all

$pwrlist[$row['ajax_result_id']]=$row['subject'];
We don't have enough information to help you because we don't have access to the database you are trying to extract information from. So you have to either ask a more specific question or do a var_dump($row) and show us the structure of your data. (please use the [ syntax=php] [ /syntax] tags when posting code.)
Post Reply