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"));
}

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"));
}

$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
}

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.