Jump to content



Welcome to KnowledgeSutra - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!
- - - - -

Another Parse Error


11 replies to this topic

#1 shadowdemon

    Super Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 209 posts

Posted 07 April 2006 - 10:27 PM

<?php $title = "Forums"; include("header.php"); ?>

<?php
// the Topic List
if ($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 Topic


if ($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 Topic
if ($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 Reply
if ($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>.";
}
?>

<?php
include("footer.php");
?>

Parse error: parse error, expecting `','' or `';'' in /home/www/dancha42.madpage.com/forums2.php on line 35

hopefully i wont have many moreim starting to learn to find them better, but i dont understand this parse error

#2 Tyssen

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPip
  • 1,161 posts
  • Location:Brisbane, QLD

Posted 07 April 2006 - 11:00 PM

There's no ; after this:

echo "<a href="forums2.php?view=topics">back</a>">

#3 jlhaslip

    Insert Custom Title Here

  • [MODERATOR]
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5,040 posts
  • Gender:Not Telling
  • Location:Linux, DOS and Windows…the good, the bad and the ugly
  • myCENT:81.07
  • Spam Patrol

Posted 07 April 2006 - 11:07 PM

Try:

		if ($stat[rank] ==  admin )


#4 Tyssen

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPip
  • 1,161 posts
  • Location:Brisbane, QLD

Posted 07 April 2006 - 11:37 PM

That won't work Jim. It's gotta be a string, doesn't it?

#5 jlhaslip

    Insert Custom Title Here

  • [MODERATOR]
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5,040 posts
  • Gender:Not Telling
  • Location:Linux, DOS and Windows…the good, the bad and the ugly
  • myCENT:81.07
  • Spam Patrol

Posted 07 April 2006 - 11:47 PM

Maybe you are right.

What's with this?
=view   


#6 shadowdemon

    Super Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 209 posts

Posted 08 April 2006 - 12:07 AM

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 elses

edit

this is the new code
<?php $title = "Forums"; include("header.php"); ?>

<?php
// the Topic List
if ($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 Topic


if ($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 Topic
if ($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 Reply
if ($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>.";
}
?>

<?php
include("footer.php");
?>

i still got the parse error tho

i 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.php

so i dont no why one has a parse error and another one doesnt

Edited by shadowdemon, 08 April 2006 - 11:39 AM.


#7 jlhaslip

    Insert Custom Title Here

  • [MODERATOR]
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5,040 posts
  • Gender:Not Telling
  • Location:Linux, DOS and Windows…the good, the bad and the ugly
  • myCENT:81.07
  • Spam Patrol

Posted 08 April 2006 - 12:50 AM

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>">
}


#8 shadowdemon

    Super Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 209 posts

Posted 08 April 2006 - 11:41 AM

View Postjlhaslip, on Apr 7 2006, 08:50 PM, said:

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.php

im about to try the code out

still got a parse error its something to do with
`','' or `';''

oh and please use the second code i posterd

Edited by shadowdemon, 08 April 2006 - 11:45 AM.


#9 jlhaslip

    Insert Custom Title Here

  • [MODERATOR]
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5,040 posts
  • Gender:Not Telling
  • Location:Linux, DOS and Windows…the good, the bad and the ugly
  • myCENT:81.07
  • Spam Patrol

Posted 08 April 2006 - 03:25 PM

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.

#10 shadowdemon

    Super Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 209 posts

Posted 08 April 2006 - 08:16 PM

View Postjlhaslip, on Apr 8 2006, 11:25 AM, said:

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.




Reply to this topic


This post will need approval from a moderator before this post is shown.

  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users