Jump to content

[SOLVED] Parse error: parse error, unexpected T_ELSE


refiking

Recommended Posts

Here is what the script returns:

 

Parse error: parse error, unexpected T_ELSE

 

Am I not seeing something here?

 

$result = mysql_query("SELECT * FROM Loans");
$num_rows = mysql_num_rows($result);
IF ($num_rows <=25){
$date = date("Y-m-d G:i:s", strtotime("+1 Day"));
$date0 = date("Y-m-d G:i:s");
$date1 = date("Y-m-d G:i:s", strtotime("+2 Day"));
$date2 = date("Y-m-d G:i:s", strtotime("+3 Day"));
$date3 = date("Y-m-d G:i:s", strtotime("+7 Day"));
}
ELSEIF($num_rows > 25) {
$date = date("Y-m-d G:i:s", strtotime("+2 Day"));
$date0 = date("Y-m-d G:i:s");
$date1 = date("Y-m-d G:i:s", strtotime("+3 Day"));
$date2 = date("Y-m-d G:i:s", strtotime("+4 Day"));
$date3 = date("Y-m-d G:i:s", strtotime("+7 Day"));
}

Link to comment
Share on other sites

try:

$result = mysql_query("SELECT * FROM Loans");
$num_rows = mysql_num_rows($result);
IF ($num_rows <=25){
$date = date("Y-m-d G:i:s", strtotime("+1 Day"));
$date0 = date("Y-m-d G:i:s");
$date1 = date("Y-m-d G:i:s", strtotime("+2 Day"));
$date2 = date("Y-m-d G:i:s", strtotime("+3 Day"));
$date3 = date("Y-m-d G:i:s", strtotime("+7 Day"));
}
ELSE  {
$date = date("Y-m-d G:i:s", strtotime("+2 Day"));
$date0 = date("Y-m-d G:i:s");
$date1 = date("Y-m-d G:i:s", strtotime("+3 Day"));
$date2 = date("Y-m-d G:i:s", strtotime("+4 Day"));
$date3 = date("Y-m-d G:i:s", strtotime("+7 Day"));
}

Link to comment
Share on other sites

$result = mysql_query("SELECT * FROM Loans");
$num_rows = mysql_num_rows($result);
IF ($num_rows <=25){
$date = date("Y-m-d G:i:s", strtotime("+1 Day"));
$date0 = date("Y-m-d G:i:s");
$date1 = date("Y-m-d G:i:s", strtotime("+2 Day"));
$date2 = date("Y-m-d G:i:s", strtotime("+3 Day"));
$date3 = date("Y-m-d G:i:s", strtotime("+7 Day"));
}
ELSEIF($num_rows > 25) {
$date = date("Y-m-d G:i:s", strtotime("+2 Day"));
$date0 = date("Y-m-d G:i:s");
$date1 = date("Y-m-d G:i:s", strtotime("+3 Day"));
$date2 = date("Y-m-d G:i:s", strtotime("+4 Day"));
$date3 = date("Y-m-d G:i:s", strtotime("+7 Day"));
}
ELSE {
//some code
}

Link to comment
Share on other sites

this must be a database problam all worked for me.......

 

It can't be, or that error message would not have been displayed.

 

The problem is a logic error somewhere in your code - obviously NOT in the bit you posted.  Somewhere you have a mis-coded if/else loop

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.