RunningClif Posted April 29, 2011 Share Posted April 29, 2011 As the title says, I am new to php and could use some help with some Parse Errors. The following code is pulled from a registration form I found, I can post the whole thing but would rather not because it is long. I'm sure each of these is simple to solve I'm just not able to and would be grateful for any help. Also if anyone has a better registration form (without all these errors) they would like to share that would be great. if ($dbc = mysql_connect (DB_HOST, DB_USER, DB_PASSWORD)) { if (!mysql_select_db (DB_NAME)) { // If it can’t select the database. // Handle the error. trigger_error(“Could not select the database!\n<br />MySQL Error: ” . mysql_error()); exit(); } // End of mysql_select_db IF. } else { // Print a message to the user, and kill the script. trigger_error(“Could not connect to MySQL!\n<br />MySQL Error: ” . mysql_error()); exit(); } Both of the trigger_error come up with parse error unexpected t_string if (isset($_SESSION['id']) AND (substr($_SERVER['PHP_SELF'], -10) != ‘logout.php’)) { echo ‘ <a href=”logout.php”>Logout</a><br /> <a href=”change_password.php”>Change Password</a><br />’; } else { // Not logged in. echo ‘ <a href=”register.php”>Register</a><br /> <a href=”login.php”>Login to your account</a><br /> <a href=”forgot_password.php”>Forgot Password</a><br />’; } In line 2 it says parse error expecting comma or semicolon if (isset($_POST['submitted'])) { // Handle the form. if (eregi (‘^[[:alpha:]\.\’ \-]{2,15}$’, stripslashes(trim($_POST['first_name'])))) { $fn = escape_data($_POST['first']); } else { $fn = FALSE; echo ‘<p><font color=”red” size=”+1″>Please enter your first name!</font></p>’; } The eregi comes up with an unexpected [ and the echo comes up with an unexpected > Thanks again for the help. Quote Link to comment https://forums.phpfreaks.com/topic/235130-hello-new-to-php-help-would-be-awesome/ Share on other sites More sharing options...
Pikachu2000 Posted April 29, 2011 Share Posted April 29, 2011 Look at your quotes. Those are curly-quotes, AKA smart-quotes, and will not work in a script. Quote Link to comment https://forums.phpfreaks.com/topic/235130-hello-new-to-php-help-would-be-awesome/#findComment-1208399 Share on other sites More sharing options...
RunningClif Posted April 29, 2011 Author Share Posted April 29, 2011 Ha thanks man, now I wish I had posted this a long time instead of wasting time.. Thanks again! Quote Link to comment https://forums.phpfreaks.com/topic/235130-hello-new-to-php-help-would-be-awesome/#findComment-1208403 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.