Help with a unexpected T

Now I have fixed the problem the T_ELSE parse error is not displaying anymore, But then how can I direct the code to display the if or the else?

Well users are going to come from either page1.php or page2.php

url coming from page1.php
cart.php?ids=1

url coming from page2.php
cart.php?idc=1

for instance if the url is coming from page1.php then cart is going to receive it like

$ids= isset($_GET['ids'])?(int) $_GET['ids']:null;

$idc= isset($_GET['idc'])?(int) $_GET['idc']:null;

if ($ids) { 
display something
} 
elseif($idc) {
display something different
}
else 
{ 

display nothing has passed 
}

Those are the conditions I have right but it is not working properly since it will display the else message "display nothing has passed". Again it will display the else statement even if I come from page1.php or page2.php. I guess the conditions are not well set up or it is passing empty. How can I set up the conditions so it can display either $ids statement or the elseif $idc.


I assume that 'blabla' isn't actually in your code but there is, in fact, something meaningful there.

Remember to test for something with your if statement.

if($some_condition) {
  for(blabla) {
    if($another_condition) {
    } // end of if statement inside the for loop
  }   // end of for loop.
}     // end of if statement 
else{ // line 379

}// end of else statement

这应该工作:

if (true) {
    for (blabla) {
        if (false) {
            // do something
        }// end of if statement inside the for loop

    } //end of for loop.

} // end of if statement 
else { // line 379
    // do something else

}// end of else statement

An else statement must immediately follow an if block, and will be associated with the if block that it follows. There cannot even be an extra } between the if block and the else .

You will get that error if you have anything other than whitespace or commetns between the } that closes the if and the else .

Can you show us exactly what that part of the file contains?

链接地址: http://www.djcxy.com/p/69832.html

上一篇: 简单的表查询语法错误?

下一篇: 帮助意外的T