DarthViper3k Posted March 3, 2003 Share Posted March 3, 2003 ok I\'ve got this update profile page all my books tell me I\'ve got this right but I keep getting an error Parse error: parse error in c:apachehtdocs3kphpprofile.php on line 16 well heres line 17 ?> heres my code please tell me what I\'m doin wrong [php:1:0691e56a93]<?php //check to see if Username, email, and password have values if(empty($password) || empty($email)) { if(empty($password)) { print(\"Sorry, your password CANNOT be blank.. please try again<BR>\"); } if(empty($email)) { print(\"Sorry, your email CANNOT be blank.. please try again<BR>\"); //if its passed the check update their information } else { mysql_query(\"UPDATE users SET password=\'$password\' WHERE username=\'$username\'\"); } ?>[/php:1:0691e56a93] Quote Link to comment Share on other sites More sharing options...
metalblend Posted March 3, 2003 Share Posted March 3, 2003 you\'re going to kick yourself. if you tab your code you\'ll see you\'re missing a } here\'s the \"repaired\" code:[php:1:252e080791]<?php //check to see if Username, email, and password have values if(empty($password) || empty($email)) { if(empty($password)) { print \"Sorry, your password CANNOT be blank.. please try again<BR>\"; } if(empty($email)) { print \"Sorry, your email CANNOT be blank.. please try again<BR>\"; //if its passed the check update their information } else { mysql_query(\"UPDATE users SET password=\'$password\' WHERE username=\'$username\'\"); } } ?>[/php:1:252e080791] ALWAYS TAB YOUR CODE Hope that helps. Quote Link to comment Share on other sites More sharing options...
NL_Johan_UK Posted March 3, 2003 Share Posted March 3, 2003 I code my php in PHP Coder, it has a great function called \'find matching brace\' . If goes all the way down your script, you know you forgot one. When the error tells you it\'s the last line of your code, or the one before, it is always a missing brace, or you forgot ?> . Just a tip... One more thing, you might want to use .... password = PASSWORD($password) WHERE... etc. It encrypts the password. You don\'t want to know all your friends / clients passwords now do you? When they log in, just match it like this: SELECT COUNT(*) FROM user_table WHERE password = PASSWORD($password) AND user_name = \'$user_name\' Good practise for privacy in your coding.. Quote Link to comment Share on other sites More sharing options...
DarthViper3k Posted March 3, 2003 Author Share Posted March 3, 2003 you\'re going to kick yourself. if you tab your code you\'ll see you\'re missing a } here\'s the \"repaired\" code:[php:1:5943dbd32d]<?php //check to see if Username, email, and password have values if(empty($password) || empty($email)) { if(empty($password)) { print \"Sorry, your password CANNOT be blank.. please try again<BR>\"; } if(empty($email)) { print \"Sorry, your email CANNOT be blank.. please try again<BR>\"; //if its passed the check update their information } else { mysql_query(\"UPDATE users SET password=\'$password\' WHERE username=\'$username\'\"); } } ?>[/php:1:5943dbd32d] ALWAYS TAB YOUR CODE Hope that helps. ohhh shit I hate that I do tab my code I just tab it differently than most :? I\'m just gonna tab it a lil differently than I normaly do so I don\'t miss that heh Quote Link to comment Share on other sites More sharing options...
metalblend Posted March 3, 2003 Share Posted March 3, 2003 glad it worked 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.