argan328 Posted March 2, 2007 Share Posted March 2, 2007 Hi I cannot figure out why I am getting the following error when I apply the login application from Janet Valade's PHP & MySQL Everyday Apps for Dummies: Parse error: parse error, unexpected '{' in /home/content/x/x/x/xxxx/html/user_login/login-OO.php on line 16 Here is the first 30 or so lines from the script: <?php /* Program: Login-OO.php * Desc: User Login Application script. The program * displays the Login Web page. New customer * registration information is validated and * stored in a database. Existing customers' * passwords are compared to valid passwords. */ require_once("WebForm.class"); #9 require_once("Account.class"); require_once("Database.class"); require_once("Session.class"); require_once("Email.class"); try #15 { $form = new WebForm("double_form.inc","fields_login.inc",$_POST); } catch(Exception $e) { echo $e->getMessage(); exit(); } //First time form is displayed. Form is blank. // if (!isset($_POST['Button'])) #26 { $form->displayForm(); exit(); } It seems like it would be so simple but have spend many hours and I can't figure it out- Please help me understand why PHP has a problem with that first curly bracket on line 16! Thanks!! ??? Argan Quote Link to comment Share on other sites More sharing options...
monk.e.boy Posted March 2, 2007 Share Posted March 2, 2007 comment out all of the include statements. Then uncomment one, run the script. Then uncomment the next and run etc. etc. Until you get the error again. The error is in the file you just uncommented. monk.e.boy Quote Link to comment Share on other sites More sharing options...
argan328 Posted March 3, 2007 Author Share Posted March 3, 2007 I tried it monk.e.boy but still am getting the same error: Parse error: parse error, unexpected '{' in /home/content/x/x/x/xxxxx/html/user_login/login-OO.php on line 16 Even when I comment out all of them like below: <?php /* Program: Login-OO.php * Desc: User Login Application script. The program * displays the Login Web page. New customer * registration information is validated and * stored in a database. Existing customers' * passwords are compared to valid passwords. */ //require_once("WebForm.class"); #9 //require_once("Account.class"); //require_once("Database.class"); //require_once("Session.class"); //require_once("Email.class"); try #15 { $form = new WebForm("double_form.inc","fields_login.inc",$_POST); } catch(Exception $e) { echo $e->getMessage(); exit(); } //First time form is displayed. Form is blank. // if (!isset($_POST['Button'])) #26 { $form->displayForm(); exit(); Am I doing it wrong? Any other ideas? Quote Link to comment Share on other sites More sharing options...
linuxdream Posted March 3, 2007 Share Posted March 3, 2007 Showing my ignorance here...but what PHP version are you using. I think try/catch was introduced in PHP 5 Quote Link to comment Share on other sites More sharing options...
argan328 Posted March 3, 2007 Author Share Posted March 3, 2007 my host tells me they support PHP versions 4.3.11 and 5.1.4 Quote Link to comment Share on other sites More sharing options...
argan328 Posted March 3, 2007 Author Share Posted March 3, 2007 ...I have even tried deleting the include statements altogether and still get the same error. I would really like to use this script, can ANYONE help me? ??? Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted March 3, 2007 Share Posted March 3, 2007 create a page with this in it: <?php phpinfo(); ?> and look for a php version. i think it is up the very top of the page. Quote Link to comment Share on other sites More sharing options...
argan328 Posted March 3, 2007 Author Share Posted March 3, 2007 Ok I did it and it says PHP Version 4.3.11 at the top. Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted March 3, 2007 Share Posted March 3, 2007 the try/catch functions are only available in PHP5 i think, check it out at the php.net website. http://php.net/try it should say at the top. if it is PHP5 only then you need to upgrade your PHP. Quote Link to comment Share on other sites More sharing options...
argan328 Posted March 3, 2007 Author Share Posted March 3, 2007 well is starts by saying: "PHP 5 has an exception model similar to that of other programming languages." If I'm running 4.3.11 I guess the error would make sense now. Forgive me for throwing out a newbie question but if my host (godaddy) says they support 4.3.11 and 5.1.4 how do I upgrade so that when I call <?php phpinfo(); ?> it says 5.1.4 at the top instead of the 4.3.11 I'm getting now? Thanks! Quote Link to comment Share on other sites More sharing options...
argan328 Posted March 3, 2007 Author Share Posted March 3, 2007 WoW, thanks! All I had to do was change the extensions on all my php files to .php5 and that did the trick with my host. I appreciate the help! 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.