Hi All,

I havefollowing code and getting error "Parse error: syntax error, unexpected 'elseif' (T_ELSEIF) in C:\xampp\htdocs\SMR\index.php on line 13". Wehen i remove elseif and keep only if it just checks the first condition and ignor the second. When i put back elseif i get error. Please to fix this issue.


    $query=mysqli_query($con,"select ID from tbladmin where  UserName='$adminuser' && Password='$password' && userlvl='$userlvl' ");
    elseif($ret>0 || userlvl==1){
elseif($ret>0 || userlvl==2){

    $msg="Invalid Details.";
Re: Syntax Error in Code 80 80

I see an if on like 6, then an unmatched elseif on line 13. The matching elseif for line 6 seems to be on line 17.

So I agree that this should fail.

Re: Syntax Error in Code 80 80

Hi @rproffitt

Thanks for the reply can you please help to rectify this code, I am new in PHP i followed the standard syntax referred on php documentation.

Kind Regards,

Re: Syntax Error in Code 80 80

Sorry Naveed,

I can't correct your code because I don't know the intent. Try this: Make a copy and paste it into another file. Now delete all the code that doesn't have if, else and elseif. Here that shows the mismatched if and more.

Re: Syntax Error in Code 80 80

Looks like the elseif on line 13 should be an if

Only strange thing is that $ret is an array, so I do not understand why you check for $ret > 0

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.