theresajayne Posted December 11, 2007 Share Posted December 11, 2007 I installed apache 2.2 and php5 for dev work on my PC, (windows) My file was working fine then suddenly i started getting the following error Parse error: syntax error, unexpected ']', expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\index.php on line 43 The line in question is $error[] = "Invalid Username or Password"; I also have errors on every Array access I use for instance if( $_SESSION['loggedin'] == 'true') gives me the error Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\index.php on line 9 WTF is going on??? it was working then suddenly went crazy like this..... Theresa Quote Link to comment Share on other sites More sharing options...
farkewie Posted December 11, 2007 Share Posted December 11, 2007 what editor did you last use? it may be some wierd characters saving? try using notepad. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted December 11, 2007 Share Posted December 11, 2007 Also, those type of syntax errors are usually caused by something immediately prior to the line that the error is reported on. Post 3-4 lines of code prior to and including the line that the error was reported on. Quote Link to comment Share on other sites More sharing options...
theresajayne Posted December 11, 2007 Author Share Posted December 11, 2007 Dreamweaver 8 is the editor used <? require_once('Smarty.class.php'); $page = 'login.html'; $t = new Smarty(); $vars = & get_input_vars(); ` $error = array(); if( $_SESSION['loggedin'] == 'true') { //logged in so just display the front page $user = array(); $user[login] = $_SESSION['login']; $user[category] = $_SESSION['category']; $user[first] = $_SESSION['first']; $user[last] = $_SESSION['last']; $t->assign('user',$user); $page = 'index.html'; } Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted December 11, 2007 Share Posted December 11, 2007 what is the "`" ? ` $error = array(); Quote Link to comment Share on other sites More sharing options...
theresajayne Posted December 11, 2007 Author Share Posted December 11, 2007 DOH That was it, a sneaky ' had worked its way into the code..... Thanks Quote Link to comment 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.