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.";

Recommended Answers

All 4 Replies

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.

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,

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.

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 developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.