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
https://forums.phpfreaks.com/topic/235130-hello-new-to-php-help-would-be-awesome/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.