Jump to content

Syntax error and switch case?


morocco-iceberg

Recommended Posts

I can't find a reason for why I'm getting this error:

 

Parse error: syntax error, unexpected '{' on line 4

 

 

And I was wondering if I should use a switch case in my code instead of what I have at the moment, or leave it as is?

 

<?php
session_start();
$error = "An error occurred, please press f5 to refresh the page and try again.";
if(!isset($_SESSION["list_score"]){
die("You cannot access this page because you have not completed a previous section of the test, or have already completed this section.");
}
$deta = $_SESSION["deta"];
$gram_score = $_SESSION["gram_score"];
$gram_time = $_SESSION["gram_time"];
$read_score = $_SESSION["read_score"];
$read_time = $_SESSION["read_time"];
$writ_score = $_SESSION["writ_score"];
$writ_time = $_SESSION["writ_time"];
$list_score = $_SESSION["list_score"];
$list_time = $_SESSION["list_time"];
$score = $gram_score + $read_score + $list_score;
if($score<12){
$v = "Beginner";
$w = 24;
$x = 36;
$y = 48;
$z = 60;
}else if($score>11 && $score<24){
$v = "Elementary";
$w = 12;
$x = 24;
$y = 36;
$z = 48;
}else if($score>23 && $score<36){
$v = "Pre-Intermediate";
$w = 0;
$x = 12;
$y = 24;
$z = 36;
}else if($score>35 && $score<48){
$v = "Intermediate";
$w = 0;
$x = 0;
$y = 12;
$z = 24;
}else if($score>47 && $score<60){
$v = "Upper-Intermediate";
$w = 0;
$x = 0;
$y = 0;
$z = 12;
}else{
$v = "Advanced";
$w = 0;
$x = 0;
$y = 0;
$z = 0;
}
echo "You are at ".$v." level."."\r\n" .
$w." weeks to enter D class."."\r\n" .
$x." weeks to enter C class"."\r\n" .
$y." weeks to enter B class"."\r\n" .
$z." weeks to enter A class";
?>	

Link to comment
https://forums.phpfreaks.com/topic/207568-syntax-error-and-switch-case/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.