Hi, iam trying to display student names along with their course selected and status of their selection, from mysql db, the result has to be in tabular format, with alternate row bg color, here is my code, please help me out...
Please share a complete code, i will be very thankful
Please share a complete code, i will be very thankful
Code:
<? include('config.php'); echo "<a href='Student Details Form.php'>New Record</a>"; echo "<table border=2 >"; echo "<tr>"; echo "<td><b>Sl No.</b></td>"; echo "<td><b>Student Name</b></td>"; echo "<td><b>Course Applied</b></td>"; echo "<td><b>Status</b></td>"; echo "</tr>"; $result = mysql_query("SELECT `stud_name` AS 'Student Name', `course_studying` AS 'Course Applied', `status` AS 'Status' FROM `cjet`.`student_details` WHERE `status` = 'Selected'") or trigger_error(mysql_error()); while($row = mysql_fetch_array($result)){ foreach($row AS $key => $value) { $row[$key] = stripslashes($value); } echo "<tr bgcolor= '$bgcolor'>"; echo "<td valign='top'>" . nl2br( $row['stud_id']) . "</td>"; echo "<td valign='top'>" . nl2br( $row['stud_name']) . "</td>"; echo "<td valign='top'>" . nl2br( $row['course_studying']) . "</td>"; echo "<td valign='top'>" . nl2br( $row['status']) . "</td>"; echo "<td valign='top'><a href=edit.php?id={$row['stud_id']}>Edit</a></td><td><a href=delete.php?id={$row['stud_id']}>Delete</a></td>"; echo "</tr>"; } echo "</table>"; echo "<a href='Student Details Form.php'>New Record</a>"; ?>
Comment