Jump to content

Hello, new to php- help would be awesome


RunningClif

Recommended Posts

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.