refiking Posted January 6, 2008 Share Posted January 6, 2008 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 https://forums.phpfreaks.com/topic/84776-solved-parse-error-parse-error-unexpected-t_else/ Share on other sites More sharing options...
papaface Posted January 6, 2008 Share Posted January 6, 2008 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 https://forums.phpfreaks.com/topic/84776-solved-parse-error-parse-error-unexpected-t_else/#findComment-432043 Share on other sites More sharing options...
refiking Posted January 6, 2008 Author Share Posted January 6, 2008 same thing Link to comment https://forums.phpfreaks.com/topic/84776-solved-parse-error-parse-error-unexpected-t_else/#findComment-432045 Share on other sites More sharing options...
john010117 Posted January 6, 2008 Share Posted January 6, 2008 In your original code, I don't see an else statement anywhere. I see an elseif statement, though. Link to comment https://forums.phpfreaks.com/topic/84776-solved-parse-error-parse-error-unexpected-t_else/#findComment-432047 Share on other sites More sharing options...
mike1313 Posted January 6, 2008 Share Posted January 6, 2008 $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 https://forums.phpfreaks.com/topic/84776-solved-parse-error-parse-error-unexpected-t_else/#findComment-432048 Share on other sites More sharing options...
revraz Posted January 6, 2008 Share Posted January 6, 2008 What line number is the error on what what is that line number same thing Link to comment https://forums.phpfreaks.com/topic/84776-solved-parse-error-parse-error-unexpected-t_else/#findComment-432055 Share on other sites More sharing options...
redarrow Posted January 6, 2008 Share Posted January 6, 2008 this must be a database problam all worked for me....... Link to comment https://forums.phpfreaks.com/topic/84776-solved-parse-error-parse-error-unexpected-t_else/#findComment-432066 Share on other sites More sharing options...
AndyB Posted January 6, 2008 Share Posted January 6, 2008 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 https://forums.phpfreaks.com/topic/84776-solved-parse-error-parse-error-unexpected-t_else/#findComment-432073 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.