Parse error driving me insane

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
php-forum Super User
php-forum Super User
Posts: 1803
Joined: Thu Mar 10, 2011 5:07 pm

Tue Apr 09, 2013 8:35 pm

Do you need "}" after mysql_close() ??

New php-forum User
New php-forum User
Posts: 20
Joined: Tue Mar 06, 2012 11:05 pm

Tue Apr 09, 2013 9:49 pm

Hi gandy92,

You have missed a curly brace(}) at the end. So the first curly brace({) does not end. Your code should look like

Code: Select all

    $con = mysql_connect("localhost");
    if (!$con){die('Could not connect: ' . mysql_error());} 
    mysql_select_db("site", $con); 
    mysql_query("INSERT INTO contact(email)VALUES ('$_POST[Email]')");
    if ($_POST['submit']){
        if ($Email) { 
                echo "Successful";
        else {
            echo "ERROR";
    }//end of 2nd brace
}//end of first brace

I think this will solve your prob. :)

php-forum Fan User
php-forum Fan User
Posts: 974
Joined: Mon Oct 01, 2012 12:32 pm

Tue Apr 09, 2013 10:01 pm

Also, look into PDO instead of mysql_ functions. mysql_ are deprecated and will probably be removed in a future version sooner rather than later. ... o-examples is a good short video of PDO in action. It's faster, more secure, and the accepted standard for database interaction with php. </rant>

Post Reply