I'm trying to read a comment that is stored in a mysql table. For some reason I always get a parse error on the last line of the file even if the last line is blank. I'm not sure if it's relevant but the connect.php works for putting the comment into the database. I'm using wampserver to host it and coding it by hand.
I think that's it's something to do with the while loop, when I comment out the while(){ and the } near the end I just get a few missing variable errors as you would expect. I'm quite new to php coding so I'm pretty sure the problem will be something simple that I've either missed or not understood properly.
Anyway, here's my code:
<?php
include "connect.php";
?>
<?php
$sql = "SELECT * FROM main";
$result = mysql_query($sql) or die("Could not get posts from table");
while($rows=mysql_fetch_array($result)){
?>
<table bgcolor="green" align="center">
<tr>
<td></td>
</tr>
<tr>
<td><strong> <? echo $rows['name']; ?> </strong></td>
</tr>
<tr>
<td> <? echo $rows['email']; ?> </td>
</tr>
<tr>
<td> <? echo $rows['comment']; ?> </td>
</tr>
</table>
<?
}
?>
Thanks for the help. :)