jeudi 29 octobre 2015

if any subject got "F" or "0", then Total Grade I want to show = "F"

I attached my output image here: this my output

    <table width="100%" style="text-align:center">
            <tr>
                <td>Subject </td>
                <td>Grade </td>
            </tr>  
    <?php

        include 'connect.php';
        $class_n =$_POST['class_n'];
        $class_s =$_POST['class_s'];
        $r =$_POST['roll'];

        $sql="select * from full_result where class_n='$class_n' AND class_s='$class_s' AND roll='$r'";
        $data = mysql_query($sql);
        $sum=0;
        while ($row = mysql_fetch_array($data)) 
        {
        $r=$row['marks'];
        if($r>=40)
        {
        $r1=$row['point'];
        }
        elseif($r<=33) 
        {
        $r1=0;
        }
        $sum=$sum+$r1;
    ?>
            <tr>
                <td><?php echo $row['subject']; ?></td>
                <td><?php echo $row['grade']; ?> </td>
                 <td><?php echo $row['point']; ?> </td>
            </tr>

    <?php } ?>
        </table>
        <br>
        <p><?php echo $sum;  
            ?> </p>

This my code, here I am try to use one condition, but it's not work. it comes almost total Marks. But I want when any subject come 0 or F. Total mark will be converted on F. Please help Expert Brothers .

Aucun commentaire:

Enregistrer un commentaire