Thundarfoot Posted January 14, 2008 Share Posted January 14, 2008 I am a complete noob, but have managed to install (and after a few days get working) Apache, mysql, php, phpmyadmin, on a windows xp machine. I have a mysql database and have created a table with 6 fields. (id, Name, Class, Grade, Comments, Pic). All fields are simple text except the id and the last field "Pic" contains this html code, <a href="folder/picturex.jpg"><img src="folder/pictureicon.jpg" width="39" height="38" border="0" /></a> My Problem is when I use my php script to display the contents of the table, in a table. The oupt places all HTML links at the top of the screen before the table, then procedes to make the table and fill it with the fields from the mysql table...(of note, any of the Pic field that does not contain HTML link, gets placed in the table proper). I found this website today, and am currently reading the tutorials section in hopes of limiting the number of noob questions I have lol. Any help is most appreciated. This is the script. $result = mysql_query("SELECT * FROM Students") or die(mysql_error()); echo "<table border='1'>"; echo "<tr> <th>Name</th> <th>Class</th> <th>Grade</th> <th>Comments</th> <th>Pic</th> </tr>"; // keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $result )) { // Print out the contents of each row into a table echo "<tr><td>"; echo $row['Name']; echo "</td><td>"; echo $row['Class']; echo "</td></tr>"; echo $row['Grade']; echo "</td></tr>"; echo $row['Comments']; echo "</td></tr>"; echo $row['Pic']; echo "</td></tr>"; } echo "</table>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/86030-solved-problem-table-puts-html-links-at-top/ Share on other sites More sharing options...
revraz Posted January 14, 2008 Share Posted January 14, 2008 Fix these three echo $row['Class']; echo "</td></tr>"; echo $row['Grade']; echo "</td></tr>"; echo $row['Comments']; echo "</td></tr>"; echo $row['Pic']; You are ending the ROW 3 times and not starting a TD Quote Link to comment https://forums.phpfreaks.com/topic/86030-solved-problem-table-puts-html-links-at-top/#findComment-439312 Share on other sites More sharing options...
Thundarfoot Posted January 14, 2008 Author Share Posted January 14, 2008 Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/86030-solved-problem-table-puts-html-links-at-top/#findComment-439317 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.