Avatar of lhaluska
lhaluska asked on

Syntax error, unexpected T_ELSEIF, expecting T_CATCH

I am getting error in my code what am I doing wrong? Parse error: syntax error, unexpected T_ELSEIF, expecting T_CATCH in admin\allpage.php on line 111. Here is line 105-128

if ($openCase == false) {
   mssql_query('ROLLBACK');
} else {
  mssql_query('COMMIT');
}

Line 111->} elseif (CaseState == "CLOSED") {
if (CaseID CONTAINS ",") {
            $stop = false;
$message = "";
            while (loop index="CID" list=(".$caseID.") delimiters=",")
                  $CheckUpdateFlag = mssql_query("SELECT      *
                        FROM      ForceSystemUpdate
                        WHERE      Case_ID = (".$caseID.")");
                        
                  if (mssql_num_rows($CheckUpdateFlag) > 0)
                        $GetName = mssql_query("SELECT       SystemName
                              FROM      NSKSystemInfo
                              WHERE      System_ID = (".$CheckUpdateFlag[System_ID].")");
                              
                        $message = ".$message. You must update system: #GetName.SystemName# in order to close ticket## (".$caseID.")!<br>">
                        $stop = true;
                  }
            }
PHP

Avatar of undefined
Last Comment
lhaluska

8/22/2022 - Mon
MasonWolf

Where is the if statement for which elseif corresponds? That's not shown in your snippet. Can you show the previous several lines to where the corresponding open brace lies?
Guy Hengel [angelIII / a3]

I made some fixes in the brackets { and } ...


if ($openCase == false)
{
  mssql_query('ROLLBACK');
}
else
{
  mssql_query('COMMIT');
}

if (CaseID CONTAINS ",")
{
    $stop = false;
    $message = "";
    while (loop index="CID" list=(".$caseID.") delimiters=",")
    {
       $CheckUpdateFlag = mssql_query("SELECT      *
                        FROM      ForceSystemUpdate
                        WHERE      Case_ID = (".$caseID.")");
                       
       if (mssql_num_rows($CheckUpdateFlag) > 0)
       {
                        $GetName = mssql_query("SELECT       SystemName
                              FROM      NSKSystemInfo
                              WHERE      System_ID = (".$CheckUpdateFlag[System_ID].")");
                             
                        $message = ".$message. You must update system: #GetName.SystemName# in order to close ticket## (".$caseID.")!<br>">
                        $stop = true;
       }
    }
 }


now, I don't see how/where that line comes from:
elseif (CaseState == "CLOSED") {

there must be some other code before that, and you are missing some { } all there..

ASKER
lhaluska

Would you like me to send all of the code?
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
ASKER
lhaluska

angelIII thank you for the help. Now I am getting a error like thiis.
Parse error: syntax error, unexpected T_STRING in C:\Inetpub\wwwroot\ServiceRequest\admin\allpage.php on line 114
MasonWolf

while (loop index="CID" list=(".$caseID.") delimiters=",")

is all messed up. PHP can't parse it, and I can't fix it because I don't know what you're trying to do.
ASKER CERTIFIED SOLUTION
Guy Hengel [angelIII / a3]

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
MasonWolf

Is CaseID a constant? I also see a $caseID variable and I'm wondering if that's supposed to be the same thing
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Guy Hengel [angelIII / a3]

indeed, a correction:

>if (CaseID CONTAINS ",")

needs to be:

if (strpos($CaseID, ",")!== false)
http://lu.php.net/manual/en/function.strpos.php 
MasonWolf

a3, you are probably my favorite expert on EE, so I hope this doesn't come across wrong. If I get back to work, can I count on you to help lhaluska get through this? This one looks like it's going to be a very long discussion, and not to be mean or anything, but I'd really like to stop monitoring and hop off this train before  going any further.
ASKER
lhaluska

Ok angellll I corrected line 114 which is if (strpos(CaseID, ",")!== false) that works great.
MasonWolf, what I am trying to do with "while (loop index="CID" list=(".$caseID.") delimiters=",")" is seperate more then one caseID that someone selects with a checkbox.
Thank you both for the help.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
Guy Hengel [angelIII / a3]

in regards to the "while" line, check out my above comment, suggesting the explode() and foreach() lines.
Guy Hengel [angelIII / a3]

@MasonWolf: no problem
MasonWolf

What does the form code look like to generate those checkboxes? Does the form use post?

My guess is you actually want something like:
$items = explode(",", $caseID);
foreach($items as $item)
{
    $CheckUpdateFlag = mssql_query("SELECT      *
                        FROM      ForceSystemUpdate
                        WHERE      Case_ID = ($item)");
                       
    if ($cuf = mssql_fetch_assoc($CheckUpdateFlag))
    {
                        $GetName = mssql_query("SELECT       SystemName
                              FROM      NSKSystemInfo
                              WHERE      System_ID = ($cuf[System_ID])");
                        $result = mssql_fetch_assoc($GetName);      
                        $message .= "You must update system: $result[SystemName] in order to close ticket #$item!<br>">
                        break;
     }
}
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER
lhaluska

angellll that works great thank you...
MasonWolf glade to see you back yes the form uses post.
MasonWolf

If that fixes it, I'm happy to be of service. I realize there may still be some trouble down the road. If you still need help though, angel is probably the top expert on EE, not counting exchange servers. You'll be fine.

Thanks for stepping up a3.
ASKER
lhaluska

Thank you both and yes I will need help down the road thanks again...
Your help has saved me hundreds of hours of internet surfing.
fblack61
MasonWolf

Were you not able to use my last comment, lhaluska? There were still several errors inside your loop which I thought I'd fixed.
ASKER
lhaluska

I am going to reopen a new question for that part.