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")); } Quote 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")); } Quote 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 Quote 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. Quote 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 } Quote 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 Quote 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....... Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.