I am having troubles finding the parse error in this script. I've been
checking for weeks. I am too new to the subject I guess.
I am trying to show a readord and them have a form at the bottom of the
page for inputting data to Update the record. I get a parse error that
points to the last line in the script so I know it is something I am missing
earlier in the script but doing a line by line it seems fine to me.
Thanks for any atempt and suggestions.
Polar :)
------------------------------
<--cut--
$query = "SELECT sub_id, username, story_title, DATE_FORMAT(dat e_submitted,
'%m/%d/%y'), category, story FROM Submission WHERE date_processed < 1 LIMIT
0,1";
$result = @mysql_query ($query); // Run the query.
if ($result) { // If OK, display the record.
echo '<table align="center" cellspacing="5" cellpadding="1" border="0"
width="500"><sp an><tr><td align="left" width="100">Sto ry ID:</td><td
align="left" width="100">Nam e</td><td align="left" width="250">Tit le</td><td
align="left" width="100">Dat e Submitte d</td><td align="left"
width="50">Cate gory</td></tr><tr><td colspan="5"></span><hr></td></tr>';
// Fetch and print the record.
while ($row = mysql_fetch_arr ay($result, MYSQL_NUM)) {
echo"<tr><td align=\"left\" width=\"100\">"
..$row[0]
.."</td><td align=\"left\" width=\"100\">"
..$row[1]
.."</td> <td align=\"left\"w idth=\"250\">"
..$row[2]
.."</td><td align=\"left\" width=\"50\">"
..$row[3]
.."</td><td align=\"left\" width=\"50\">"
..$row[4]
.."</td></tr><tr><td colspan=\"5\"wi dth=\"500\"><br >"
..nl2br($row[5])
.."</td></tr>\n";
}
echo '</table>';
echo '<hr>';
if (isset($_POST['submit'])) { // Handle the form.
if (isset($_POST['accepted']) == 'Y') {
$acc = $_POST['accepted'];
echo "<b><p>Grea t A story to pass on!</p></b>";
$query = "UPDATE Submission SET reader={$_SESSI ON['username']},
date_processed= NOW(), accepted=$acc WHERE sub_id=$row[0]";
} elseif (isset($_POST['accepted']) == 'N') {
$acc = $_POST['accepted'];
echo "<b><p>Try again with a new story!</p></b>";
$query = "UPDATE Submission SET reader={$_SESSI ON['username']},
date_processed= NOW(), accepted=$acc WHERE sub_id=$row[0]";
$result = @mysql_query ($query); // Run the query.
if (mysql_affected _rows() == 1) { // If it ran OK.
echo 'Done';
include ('includes/footer.html'); // Include the HTML footer.
exit();
} else { // If no accepted was selected...
$accepted = NULL;
echo '<p><b>You forgot to enter Yes or No for the story
acceptance!</b></p>';
}
}
?>
checking for weeks. I am too new to the subject I guess.
I am trying to show a readord and them have a form at the bottom of the
page for inputting data to Update the record. I get a parse error that
points to the last line in the script so I know it is something I am missing
earlier in the script but doing a line by line it seems fine to me.
Thanks for any atempt and suggestions.
Polar :)
------------------------------
<--cut--
$query = "SELECT sub_id, username, story_title, DATE_FORMAT(dat e_submitted,
'%m/%d/%y'), category, story FROM Submission WHERE date_processed < 1 LIMIT
0,1";
$result = @mysql_query ($query); // Run the query.
if ($result) { // If OK, display the record.
echo '<table align="center" cellspacing="5" cellpadding="1" border="0"
width="500"><sp an><tr><td align="left" width="100">Sto ry ID:</td><td
align="left" width="100">Nam e</td><td align="left" width="250">Tit le</td><td
align="left" width="100">Dat e Submitte d</td><td align="left"
width="50">Cate gory</td></tr><tr><td colspan="5"></span><hr></td></tr>';
// Fetch and print the record.
while ($row = mysql_fetch_arr ay($result, MYSQL_NUM)) {
echo"<tr><td align=\"left\" width=\"100\">"
..$row[0]
.."</td><td align=\"left\" width=\"100\">"
..$row[1]
.."</td> <td align=\"left\"w idth=\"250\">"
..$row[2]
.."</td><td align=\"left\" width=\"50\">"
..$row[3]
.."</td><td align=\"left\" width=\"50\">"
..$row[4]
.."</td></tr><tr><td colspan=\"5\"wi dth=\"500\"><br >"
..nl2br($row[5])
.."</td></tr>\n";
}
echo '</table>';
echo '<hr>';
if (isset($_POST['submit'])) { // Handle the form.
if (isset($_POST['accepted']) == 'Y') {
$acc = $_POST['accepted'];
echo "<b><p>Grea t A story to pass on!</p></b>";
$query = "UPDATE Submission SET reader={$_SESSI ON['username']},
date_processed= NOW(), accepted=$acc WHERE sub_id=$row[0]";
} elseif (isset($_POST['accepted']) == 'N') {
$acc = $_POST['accepted'];
echo "<b><p>Try again with a new story!</p></b>";
$query = "UPDATE Submission SET reader={$_SESSI ON['username']},
date_processed= NOW(), accepted=$acc WHERE sub_id=$row[0]";
$result = @mysql_query ($query); // Run the query.
if (mysql_affected _rows() == 1) { // If it ran OK.
echo 'Done';
include ('includes/footer.html'); // Include the HTML footer.
exit();
} else { // If no accepted was selected...
$accepted = NULL;
echo '<p><b>You forgot to enter Yes or No for the story
acceptance!</b></p>';
}
}
?>
Comment