mtgriffiths Posted March 21, 2008 Share Posted March 21, 2008 Hi All, I am tryin to print out a table depending on the results of my query. All the information echos out correctly but i cant get the layout correct what so ever. The code im using is: <?php $Search = mysql_query("SELECT DISTINCT students.Enrollment, students.First_Name, students.Last_Name, student_attendance.Student_ID, student_attendance.Date FROM students INNER JOIN student_attendance ON students.Student_ID = student_attendance.Student_ID WHERE student_attendance.Date = '$Date'")or die(mysql_error()); ?> <?php echo "<table border='0'>"; echo "<tr align='center'>"; echo "<td width='20%'><font color='#FFFFFF' face='Calibri'>"; echo "Enrollment No"; echo "</td><td width='20%'><font color='#FFFFFF' face='Calibri'>"; echo "First Name"; echo "</td><td width='20%'><font color='#FFFFFF' face='Calibri'>"; echo "Last Name"; echo "</td><td width='20%'><font color='#FFFFFF' face='Calibri'>"; echo "Date"; echo "</td></tr>"; while($myrow = mysql_fetch_array($Search)) { echo "<tr align='center'>"; echo "<td><font color ='White' face = 'calibri'>"; echo $myrow['Enrollment']; echo "</td><td><font color ='White' face = 'calibri'>"; echo $myrow['First_Name']; echo "</td><td><font color ='White' face = 'calibri'>"; echo $myrow['Last_Name']; echo "</td><td><font color ='White' face = 'calibri'>"; echo $myrow['Date']; echo "</td></tr>"; echo "</table>"; } ?> Can any one help me? Thanks Matthew Link to comment https://forums.phpfreaks.com/topic/97281-printing-out-a-table/ Share on other sites More sharing options...
cooldude832 Posted March 21, 2008 Share Posted March 21, 2008 and the correct layout involves dancing clowns feeding penguins on the moon? Link to comment https://forums.phpfreaks.com/topic/97281-printing-out-a-table/#findComment-497816 Share on other sites More sharing options...
mtgriffiths Posted March 21, 2008 Author Share Posted March 21, 2008 The layout i mean is that all the data falls into the correct field in the table Link to comment https://forums.phpfreaks.com/topic/97281-printing-out-a-table/#findComment-497817 Share on other sites More sharing options...
AndyB Posted March 21, 2008 Share Posted March 21, 2008 move the closing table tag outside the while loop. Link to comment https://forums.phpfreaks.com/topic/97281-printing-out-a-table/#findComment-497819 Share on other sites More sharing options...
Caesar Posted March 21, 2008 Share Posted March 21, 2008 and the correct layout involves dancing clowns feeding penguins on the moon? Probably one of the top 5 best posts I've seen on these boards since I signed up :-P Link to comment https://forums.phpfreaks.com/topic/97281-printing-out-a-table/#findComment-497826 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.