shadowdemon 0 Report post Posted April 7, 2006 <?php $title = "Forums"; include("header.php"); ?><?php// the Topic Listif ($view == topics) { print "<table><tr><td width=150><u><b>Topic</td><td width=100><u><b>Starter</td><td width=50><b><u>Replies</td></tr>"; $tsel = mysql_query("select * from topics2"); while ($topic = mysql_fetch_array($tsel)) { $replies = mysql_num_rows(mysql_query("select * from replies2 where topic_id=$topic[id]")); if ($sticky == yes){print "<tr><td><a href=forums.php?topic=$topic[id]>$topic[topic]</a></td><td>$topic[starter]</td><td>$replies</td></tr>";} print "<tr><td><a href=forums.php?topic=$topic[id]>$topic[topic]</a></td><td>$topic[starter]</td><td>$replies</td></tr>"; } print "</table>"; print "</center><form method=post action=forums2.php?action=addtopic>"; print "Add Topic:<br><input type=text name=title2 value=Title><br><textarea name=body cols=30 rows=3>Body</textarea><br><input type=submit value=\"Add Topic\"></form>";}// View Topicif ($topic) { $topicinfo = mysql_fetch_array(mysql_query("select * from topics2 where id=$topic")); if (empty ($topicinfo[id])) { print "No such topic."; include("footer2.php"); exit; } if ($stat[rank] == 'admin'){ echo "<a href="forums2.php?action=sticky">sticky the topic</a>";} if ($action == sticky){mysql_query("Update topics2 set sticky=yes where topic_id=$topic[id]"); echo "<a href="forums2.php?view=topics">back</a>">}=view print "<center><br><table class=td width=98% cellpadding=0 cellspacing=0><tr><td style=\"border-bottom: solid black 1px;\" bgcolor=eeeeee><b>$topicinfo[topic]</b> by $topicinfo[starter] (<a href=forums2.php?view=topics>back</a>)</td></tr>"; print "<tr><td>$topicinfo[body]</td></tr></table><br>"; $rsel = mysql_query("select * from replies2 topic_id=$topicinfo[id] order by id asc"); while ($reply = mysql_fetch_array($rsel)) { print "<center><table class=td width=98% cellpadding=0 cellspacing=0><tr><td bgcolor=eeeeee style=\"border-bottom: solid black 1px;\"><b>$reply[starter]</b> says... (<a href=forums2.php?view=topics>back</a>)</td></tr>"; print "<tr><td>$reply[body]</td></tr></table><br>"; } print "</center><form method=post action=forums.php?reply=$topicinfo[id]>"; print "Add Reply:<br><textarea name=rep cols=30 rows=3>Body</textarea><br><input type=submit value=\"Add Reply\"></form>";}// Add Topicif ($action == addtopic) { if (empty ($title) || empty ($body)) { print "You must fill all fields."; include("footer2.php"); exit; } mysql_query("insert into topics2 (topic, body, starter) values('$title2', '$body', '$stat[user]')") or die("Could not add topic."); print "Added topic. Click <a href=forums2.php?view=topics>here</a> to go back to the topic list.";}// Add Replyif ($reply) {$exists = mysql_num_rows(mysql_query("select * from topics2 where id=$reply")); if ($exists <= 0) { print "No such topic."; include("footer2.php"); exit; } if (empty ($rep)) { print "You must fill out all fields."; include("footer2.php"); exit; }mysql_query("insert into replies2 (starter, topic_id, body) values('$stat[user]', $reply, '$rep')") or die("Could not add reply.");print "Reply added. Click <a href=forums2.php?topic=$reply>here</a>.";}?><?phpinclude("footer.php");?> Parse error: parse error, expecting `','' or `';'' in /home/www/dancha42.madpage.com/forums2.php on line 35hopefully i wont have many moreim starting to learn to find them better, but i dont understand this parse error Share this post Link to post Share on other sites
Tyssen 0 Report post Posted April 7, 2006 There's no ; after this:echo "<a href="forums2.php?view=topics">back</a>"> Share this post Link to post Share on other sites
jlhaslip 4 Report post Posted April 7, 2006 Try: if ($stat[rank] == admin ) Share this post Link to post Share on other sites
Tyssen 0 Report post Posted April 7, 2006 That won't work Jim. It's gotta be a string, doesn't it? Share this post Link to post Share on other sites
jlhaslip 4 Report post Posted April 7, 2006 Maybe you are right.What's with this? =view Share this post Link to post Share on other sites
shadowdemon 0 Report post Posted April 8, 2006 (edited) oh ty now i no what i deleted. I say something and didnt no what it was so i deleted it so ill try that and everyone elseseditthis is the new code <?php $title = "Forums"; include("header.php"); ?><?php// the Topic Listif ($view == topics) { print "<table><tr><td width=150><u><b>Topic</td><td width=100><u><b>Starter</td><td width=50><b><u>Replies</td></tr>"; $tsel = mysql_query("select * from topics2"); while ($topic = mysql_fetch_array($tsel)) { $replies = mysql_num_rows(mysql_query("select * from replies2 where topic_id=$topic[id]")); if ($sticky == yes){print "<tr><td><a href=forums2.php?topic=$topic[id]>$topic[topic]</a></td><td>$topic[starter]</td><td>$replies</td></tr>";} print "<tr><td><a href=forums2.php?topic=$topic[id]>$topic[topic]</a></td><td>$topic[starter]</td><td>$replies</td></tr>"; } print "</table>"; print "</center><form method=post action=forums2.php?action=addtopic>"; print "Add Topic:<br><input type=text name=title2 value=Title><br><textarea name=body cols=30 rows=3>Body</textarea><br><input type=submit value=\"Add Topic\"></form>";}// View Topicif ($topic) { $topicinfo = mysql_fetch_array(mysql_query("select * from topics2 where id=$topic")); if (empty ($topicinfo[id])) { print "No such topic."; include("footer2.php"); exit; } if ($stat[rank] == 'admin'){ echo "<a href="forums2.php?action=sticky">sticky the topic</a>";} if ($action == sticky){mysql_query("Update topics2 set sticky=yes where topic_id=$topic[id]"); echo "<a href="forums2.php?view=topics">back</a>";} print "<center><br><table class=td width=98% cellpadding=0 cellspacing=0><tr><td style=\"border-bottom: solid black 1px;\" bgcolor=eeeeee><b>$topicinfo[topic]</b> by $topicinfo[starter] (<a href=forums.php?view=topics>back</a>)</td></tr>"; print "<tr><td>$topicinfo[body]</td></tr></table><br>"; $rsel = mysql_query("select * from replies2 where topic_id=$topicinfo[id] order by id asc"); while ($reply = mysql_fetch_array($rsel)) { print "<center><table class=td width=98% cellpadding=0 cellspacing=0><tr><td bgcolor=eeeeee style=\"border-bottom: solid black 1px;\"><b>$reply[starter]</b> says... (<a href=forums2.php?view=topics>back</a>)</td></tr>"; print "<tr><td>$reply[body]</td></tr></table><br>"; } print "</center><form method=post action=forums2.php?reply=$topicinfo[id]>"; print "Add Reply:<br><textarea name=rep cols=30 rows=3>Body</textarea><br><input type=submit value=\"Add Reply\"></form>";}// Add Topicif ($action == addtopic) { if (empty ($title) || empty ($body)) { print "You must fill all fields."; include("footer2.php"); exit; } mysql_query("insert into topics2 (topic, body, starter) values('$title2', '$body', '$stat[user]')") or die("Could not add topic."); print "Added topic. Click <a href=forums2.php?view=topics>here</a> to go back to the topic list.";}// Add Replyif ($reply) {$exists = mysql_num_rows(mysql_query("select * from topics2 where id=$reply")); if ($exists <= 0) { print "No such topic."; include("footer2.php"); exit; } if (empty ($rep)) { print "You must fill out all fields."; include("footer2.php"); exit; }mysql_query("insert into replies2 (starter, topic_id, body) values('$stat[user]', $reply, '$rep')") or die("Could not add reply.");print "Reply added. Click <a href=forums2.php?topic=$reply>here</a>.";}?><?phpinclude("footer.php");?> i still got the parse error thoi took this exact code from a copy page with a few small changes like topics to topics2 and replies to replies2 and forums.php to forums2.phpso i dont no why one has a parse error and another one doesnt Edited April 8, 2006 by shadowdemon (see edit history) Share this post Link to post Share on other sites
jlhaslip 4 Report post Posted April 8, 2006 Is this $stat[rank] getting set to a value someplace we can't see, like maybe in the first include file??Replacing this stray end angle bracket with a semi-colon might help. if ($action == sticky){mysql_query("Update topics2 set sticky=yes where topic_id=$topic[id]"); echo "<a href="forums2.php?view=topics">back</a>">} Share this post Link to post Share on other sites
shadowdemon 0 Report post Posted April 8, 2006 (edited) Is this $stat[rank] getting set to a value someplace we can't see, like maybe in the first include file??Replacing this stray end angle bracket with a semi-colon might help. if ($action == sticky){mysql_query("Update topics2 set sticky=yes where topic_id=$topic[id]"); echo "<a href="forums2.php?view=topics">back</a>">} the $stat[rank] is included in the header.phpim about to try the code outstill got a parse error its something to do with `','' or `';'' oh and please use the second code i posterd Edited April 8, 2006 by shadowdemon (see edit history) Share this post Link to post Share on other sites
jlhaslip 4 Report post Posted April 8, 2006 Original: if ($action == sticky){mysql_query("Update topics2 set sticky=yes where topic_id=$topic[id]"); echo "<a href="forums2.php?view=topics">back</a>">}Try:if ($action == sticky){mysql_query("Update topics2 set sticky=yes where topic_id=$topic[id]"); echo '<a href="forums2.php?view=topics">back</a>';}Notice the single quotes on the outer parts of the echo and the semi-colon at the end. Share this post Link to post Share on other sites
shadowdemon 0 Report post Posted April 8, 2006 Original: if ($action == sticky){mysql_query("Update topics2 set sticky=yes where topic_id=$topic[id]"); echo "<a href="forums2.php?view=topics">back</a>">}Try:if ($action == sticky){mysql_query("Update topics2 set sticky=yes where topic_id=$topic[id]"); echo '<a href="forums2.php?view=topics">back</a>';}Notice the single quotes on the outer parts of the echo and the semi-colon at the end. still have the problem. I am gonna ask my friend when he logs on if he can figure it out but if you guys cant i dont think he will be able to. Share this post Link to post Share on other sites
WindAndWater 0 Report post Posted April 9, 2006 echo "<a href="forums2.php?action=sticky">sticky the topic</a>";...echo "<a href="forums2.php?view=topics">back</a>"; Those "s need to be escaped, so that you have: echo "<a href=\"forums2.php?action=sticky\">sticky the topic</a>";...echo "<a href=\"forums2.php?view=topics\">back</a>";jlhaslip noticed the second one but missed the first. What happens is the computer sees echo "<a href="forums2.php?action=sticky" (this is a full command) >sticky the topic</a>"; (this is a second command, but there doesn't seem to be a ';' seperating them). I hope that helps. Also, with syntax errors like this, the computer will usually give you a line number that the error occured on. If you have this kind of problem again, it's really helpful to specify what the few lines around that line number are. Share this post Link to post Share on other sites
shadowdemon 0 Report post Posted April 13, 2006 echo "<a href="forums2.php?action=sticky">sticky the topic</a>";...echo "<a href="forums2.php?view=topics">back</a>"; Those "s need to be escaped, so that you have: echo "<a href=\"forums2.php?action=sticky\">sticky the topic</a>";...echo "<a href=\"forums2.php?view=topics\">back</a>";jlhaslip noticed the second one but missed the first. What happens is the computer sees echo "<a href="forums2.php?action=sticky" (this is a full command) >sticky the topic</a>"; (this is a second command, but there doesn't seem to be a ';' seperating them). I hope that helps. Also, with syntax errors like this, the computer will usually give you a line number that the error occured on. If you have this kind of problem again, it's really helpful to specify what the few lines around that line number are. ty for the help Share this post Link to post Share on other sites