MDanz Posted February 18, 2010 Share Posted February 18, 2010 Parse error: syntax error, unexpected '}' , on the line with the first for loop. if($screen_resolution =="1024x768"){ for($col = 0; $col < 9; $col++) } elseif($screen_resolution =="1440x900"){ for($col = 0; $col < 14; $col++) } Link to comment https://forums.phpfreaks.com/topic/192457-parse-error-help/ Share on other sites More sharing options...
schilly Posted February 18, 2010 Share Posted February 18, 2010 is there a reason you're doing nothing with those for loops? i'm pretty sure for loops require {} Link to comment https://forums.phpfreaks.com/topic/192457-parse-error-help/#findComment-1014090 Share on other sites More sharing options...
MDanz Posted February 18, 2010 Author Share Posted February 18, 2010 this would be easy.. but i don't know where the brackets end, so i put the if statement just around the start of the for loop and the for loop brackets outside the if statements. Is there a program that can contract brackets in php code? Link to comment https://forums.phpfreaks.com/topic/192457-parse-error-help/#findComment-1014097 Share on other sites More sharing options...
GKWelding Posted February 18, 2010 Share Posted February 18, 2010 Random code, the sane way of doing what your code does above is the following. if($screen_resolution =="1024x768") { $col = 8; }else if($screen_resolution =="1440x900") { $col = 13; } Link to comment https://forums.phpfreaks.com/topic/192457-parse-error-help/#findComment-1014099 Share on other sites More sharing options...
GKWelding Posted February 18, 2010 Share Posted February 18, 2010 ok, have just read your reply. I get what you're trying to do, but this is the completely wrong way to go about it. You should do the following. if($screen_resolution =="1024x768") { $max = 9; }else if($screen_resolution =="1440x900") { $max = 14; } for($col = 0; $col < $max; $col++) { // code in your for loop... } Link to comment https://forums.phpfreaks.com/topic/192457-parse-error-help/#findComment-1014101 Share on other sites More sharing options...
MDanz Posted February 18, 2010 Author Share Posted February 18, 2010 thx, this should do it.. Link to comment https://forums.phpfreaks.com/topic/192457-parse-error-help/#findComment-1014104 Share on other sites More sharing options...
MDanz Posted February 18, 2010 Author Share Posted February 18, 2010 nvm Link to comment https://forums.phpfreaks.com/topic/192457-parse-error-help/#findComment-1014105 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.