Tuesday 28 February 2017

What's wrong? PHP Parse error: syntax error, unexpected '}', expecting ',' or ';' in




Me and my mate we're trying to solve this for over 1.5 hours, we are still getting the same and tried almost everything we could.



Could anyone help us do that?



This is error what we're getting:



PHP Parse error: syntax error, unexpected '}', expecting ',' or ';' in



And this is the code (line) it's happening on:



if(!isset($_POST['name'])) {echo"Please fill in a valid username"} else {$ok="$ok+1"}



It's PHP.



If anyone wants the full code here it is:



$ok=0;
if(isset($_POST['submit'])) {

if(!isset($_POST['name'])) {echo"Please fill in a valid username"} else {$ok="$ok+1"}
if(!isset($_POST['pass'])) {echo"Please fill in a valid password"} else {$ok="$ok+1"}

if($ok==2){
switch($_POST['name'],$_POST['pass']){
case "FORAEROND","FORAEROND2":


THIS IS THE TEXT THAT WILL SHOW IF USERNAME IS 'FORAEROND' AND PASSWROD IS 'FORAEROND2'



break;



/*case "FORAEROND5","FORAEROND6"; KEEP FOR LATER

THIS IS THE TEXT THAT WILL SHOW IF USERNAME IS 'FORAEROND5' AND PASSWROD IS 'FORAEROND6'



break;
*/

}
}
}


Thanks to everyone who will help. :)



EDIT:




We apologize to everyone, it was really stupid, somehow we deleted or forgot ';' behind the codes, this is really stupid and awkward.


Answer



You missed ;. Each statement must ends up with a semicolon in PHP.


No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...