Anyway, here's my code:
<?php
session_start();
if(!isset($_SESSION['studentid'])){
header("location:delogin.php");
}
else {
$loggedin=1;
(int)$StudentID=$_SESSION['studentid'];
}
if ($logginin=1){
$con = mysql_connect(CONNECT STUFF, MINE)or die('Could not connect: ' . mysql_error());
mysql_select_db("otherope_dedb",$con)or die("Cannot select Database: ' . mysql_error())");
$sql="SELECT * FROM DEStudents WHERE StudentID=$StudentID";
$result=mysql_query($sql, $con) or die(mysql_error());
while($row=mysql_fetch_array($result)){
extract($row);
}
}
?>
<html>
<body>
<table width="100%" border="1">
<tr>
<td width="20%">From:</td>
<td width="70%">Message:</td>
<td width="10%">Mark?</td>
</tr>
<?php
$sql = "SELECT * FROM Adminmessages WHERE Readbyadmin=0";
$result = mysql_query($sql, $con);
while($myrow = mysql_fetch_array($result)){
echo "<tr>";
echo "<td width=\"20%\">";
echo $myrow['FirstName'];
echo " ";
echo $myrow['LastName'];
echo " ";
echo $myrow['StudentID'];
echo "</td>";
echo "<td width=\"70%\">";
echo $myrow['Message'];
echo "</td>";
echo "<td width=\"10%\">";
echo('<input type="checkbox" name="' .$myrow['M_Id'] . '" value="' .$myrow['M_Id'] . '">);
echo "</tr>";
}
?>
</table>
</body>
</html>
I know, my code is VERY ugly and mashed together and atrocious. However, for the most part, it's working fine. My two main problems:
1. The checkbox part isn't working, it complained about unexpected character "'" (Yes, that ' in the middle).
2. I want the teacher to be able to, on a form submission, have all marked messages set their 'Readbyadmin' column in the database to 1, rather than default 0.
3. (Not Major) Auto delete messages marked as read after 2 weeks.
Once again, I need you help...

New Topic/Question
Reply




MultiQuote







|