Here's the code I'm referencing for this question:
<?php
if(isset($HTTP_POST_VARS['submit'])) {
/* SQL STUFF HERE */
}
print '<form action="http://www.foo.com/footest/admin.php method="post">';
print '<p>Make new post</p>';
print '<textarea cols="40" rows="20" name="newpost"></textarea>';
print '<input type="submit" value="Submit" />';
print '</form>';
print '<h1>Old Posts</h1>';
mysql_pconnect("mysql9.foo.com", "foo", "foo") or die("Can't connect to MySQL Server");
mysql_select_db("news_database") or die("Can't find the MySQL database");
$query = "SELECT entrydate, id, post FROM news_entries ORDER BY entrydate";
$result = mysql_query($query) or die("Couldn't retrieve posts");
while($row = mysql_fetch_array($result,MYSQL_NUM)) {
$dater = $row[0]
$poster = $row[2];
$ider = $row[1];
print "$dater";
print "<br />";
print "$poster";
print "<br />";
print "$ider";
print "<br />";
print "<a href=\"delete.php?id=$ider\">Delete</a>";
print "<a href=\"edit.php?id=$ider\">Edit</a>";
}
?>
Essentially, I'm printing out a small forum, and then below it some data from a MySQL database. The MySQL code is pulling data from a table with 3 fields, id, entrydate, and post. Then I try to print out the array with a while loop.
The error I get is: Parse error: syntax error, unexpected T_VARIABLE in /www/l/lg/htdocs/footest/admin.php on line 12
Line 12 is: print '</form>';
However, I find that deleting the lines:
$dater = $row[0]
$poster = $row[2];
$ider = $row[1];
and then trying again prints out the page fine (of course minus the MySQL data). Am I accessing the array incorrectly?