I want to change the status of any particular subject through check boxes and a single button. Basically I want to the value of status cell w.r.t. subCode through UPDATE query. I am writing my code below:
<?php
$connect = mysql_connect("localhost","root","") or die(mysql_error());
$db = mysql_select_db("new") or die(mysql_error());
$query = mysql_query("SELECT * FROM subject");
echo "<div>
<table>
<tr>
<th></th>
<th>Subject Code</th>
<th>Subject Name</th>
<th>L</th>
<th>T</th>
<th>P</th>
<th>Program</th>
<th>Semester</th>
<th>Batch</th>
<th>Staus</th>
</tr>";
while($row = mysql_fetch_assoc($query))
{
$dbSubCode = $row['subCode'];
$dbSubName = $row['subName'];
$dbLecture = $row['lecture'];
$dbPractical = $row['practical'];
$dbTheory = $row['theory'];
$dbProgram = $row['program'];
$dbSemester = $row['semester'];
$dbBatch = $row['batch'];
$dbStatus = $row['substatus'];
echo "
<tr>
<td><input type='checkbox'></td>
<td>$dbSubCode</td>
<td>$dbSubName</td>
<td>$dbLecture</td>
<td>$dbTheory</td>
<td>$dbPractical</td>
<td>$dbProgram</td>
<td>$dbSemester</td>
<td>$dbBatch</td>
<td>$dbStatus</td>
</tr>";
}
echo "</table>
<button type='button'>Change Status</button>
</div>";
?>
This is the result of my code.
Please can you tell me what do now? I have been stuck at this point for weeks.
Aucun commentaire:
Enregistrer un commentaire