4 Replies - 321 Views - Last Post: 26 February 2011 - 09:30 PM Rate Topic: -----

#1 Snipeye  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 77
  • Joined: 19-September 09

Unexpected T_STRING

Posted 26 February 2011 - 09:04 PM

Getting the error on line 22, here's the whole code:

<?php
include 'admincondata.php';
$safearray=$_POST['safearray'];
$messagearray=base64_decode($safearray);
$array=unserialize($messagearray);
$whatessay=$_POST['whatessay'];
foreach ($array as $studentid){
	if ($studentid=$_POST[$studentid]){
		$sql="SELECT $whatessay FROM DEStudents WHERE StudentID=$studentid";
		$submitresult=mysql_query($sql, $con) or die(mysql_error());
		(int)$whatsubmission=mysql_fetch_assoc($submitresult) or die(mysql_error());
		if ($whatsubmission=2){
			if (isset($_POST['passmarked'])){
				$sql="UPDATE DEStudents SET $whatessay=1 WHERE StudentID = $studentid";
				mysql_query($sql, $con) or die(mysql_error());
			}
			elseif (isset($_POST['failmarked'])){
				$sql="UPDATE DEStudents SET $whatessay=-1 WHERE StudentID = $studentid";
				mysql_query($sql, $con) or die(mysql_error());
			}
			else {
				die(Something went wrong.  Please talk to the creator of the website.);
			}
		elseif ($whatsubmission==3){
				if (isset($_POST['passmarked'])){
				$sql="UPDATE DEStudents SET $whatessay=1 WHERE StudentID = $studentid";
				mysql_query($sql, $con) or die(mysql_error());
			}
			elseif (isset($_POST['failmarked'])){
				$sql="UPDATE DEStudents SET $whatessay=-2 WHERE StudentID = $studentid";
				mysql_query($sql, $con) or die(mysql_error());
			}
			else {
				die(Something went wrong.  Please talk to the creator of the website.);
			}
		}
	}
}
echo 'Done.';
?>



I've been over it multiple times, can't seem to find anything. I really need a pair of fresh eyes...

EDIT: I know, the code mashing-together-ness is atrocious. Please forgive me.

This post has been edited by Snipeye: 26 February 2011 - 09:05 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Unexpected T_STRING

#2 SeanKeenan  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 74
  • Joined: 23-March 09

Re: Unexpected T_STRING

Posted 26 February 2011 - 09:11 PM

die ("Something went wrong") 


You forgot the ""
I didn't look at the rest but I guess that's what it is.
Was This Post Helpful? 1
  • +
  • -

#3 Snipeye  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 77
  • Joined: 19-September 09

Re: Unexpected T_STRING

Posted 26 February 2011 - 09:19 PM

>.<

Aww, man. I hate spending so long on such a stupid little error like that. Thanks.
Was This Post Helpful? 0
  • +
  • -

#4 SeanKeenan  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 74
  • Joined: 23-March 09

Re: Unexpected T_STRING

Posted 26 February 2011 - 09:21 PM

View PostSnipeye, on 27 February 2011 - 04:19 AM, said:

>.<

Aww, man. I hate spending so long on such a stupid little error like that. Thanks.


I know the feeling, trust me! No problem anyway :)
Ps. There's another at the bottom ;)
Was This Post Helpful? 0
  • +
  • -

#5 Snipeye  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 77
  • Joined: 19-September 09

Re: Unexpected T_STRING

Posted 26 February 2011 - 09:30 PM

View PostSeanKeenan, on 26 February 2011 - 09:21 PM, said:

View PostSnipeye, on 27 February 2011 - 04:19 AM, said:

>.<

Aww, man. I hate spending so long on such a stupid little error like that. Thanks.


I know the feeling, trust me! No problem anyway :)
Ps. There's another at the bottom ;)



Yeah, I got that one, too.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1