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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.