Grade Viewing of Student in php
Get the solution ↓↓↓Hello, I am new in php I am making an Web Based Online Grading System, my problem is I want to view my grade as a Student When i logged in as a Student it displays all the data from the grades that i uploaded.
<?php
$con = mysqli_connect('localhost','root','','grade') or die(mysqli_error());
$query = "Select * from grades where sID <= ID";
$result = mysqli_query($con,$query);
while ($row = mysqli_fetch_assoc($result)) {
$studentid = $row['StudentID'];
$firstname = $row['StudentName'];
$subject = $row['Subject'];
$desc = $row['Description'];
$first = $row['Prelim'];
$second = $row['Midterm'];
$third = $row['PreFinal'];
$fourth = $row['Final'];
$final = $row['Equi'];
$remark = $row['Remarks'];
?>
<td> <?php echo $subject ?> </td>
<td> <?php echo $desc ?> </td>
<td> <?php echo $first ?> </td>
<td> <?php echo $second ?> </td>
<td> <?php echo $third ?> </td>
<td> <?php echo $fourth ?> </td>
<td> <?php echo $final ?> </td>
<td> <?php echo $remark ?> </td>
</tr>
<?php } ?>
Answer
Solution:
You will want to change your query to useWHERE
in relation toStudentID
(ore perhapssID
?? not sure based on your query statement):
"SELECT * FROM `grades` where `StudentID` = ?"
?
being the ID value which may need to be bound, if it's numeric and you check that it is before using it in the query may not need binding but binding parameters is safer.
Presumably, you have stored theStudentID
in a session or cookie after the user logs in, so that is where you would draw that value from.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: target class [commandmakecommand] does not exist.
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.