SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Oct 2002
    Posts
    311
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Parse error, can't think of better subject title...

    Hey,

    Keep getting a parse error on line 59, have no idea why. Anyone spot some wrong code here?

    Line 59 is this:

    PHP Code:
    $error .= "New user registration completed. You have been emailed your password.<br>\n"
    Here is the rest of the code:

    PHP Code:
    <?php 

    #open session#
    session_save_path('/home/accessdata'); 
    session_start(); 

    if (
    $access_name=="") {
    $title "Hello, you are not logged in. Please click <a href=\"login.php\">here</a> to log in. To sign up click 
    <a href=signup.php>here</a>."
    ;
    }else{ 
    $title "Hello $access_name, please click <a href=/members/welcome.php>here</a> to visit the distributors section.";
    }


    $form_complete="";
    if (
    $formsubmit==1) {$formsubmit="";$sucess="";

    #db connection#
    include("access/data.inc.php");
    mysql_connect ($SQLhost$SQLuser$SQLpass);
    mysql_select_db ($SQLdb);

    #null error report.#
    $error="";

    if (
    $refer=="") {$error_field=1$error.="Please enter the person who refered you.<br>\n";}
    if (
    $email=="") {$error_field=1$error.="Please enter your Email Address.<br>\n";}

    else{

    #Check email address validity#
    if(!ereg("^[_a-zA-Z0-9-]+(.[_a-zA-Z0-9-]+)*@([a-zA-Z0-9-]+.)+([a-zA-z]{2,3})$",$email)) {
      
    $error .= "Your email address is not valid, please try again.<br>\n";
    }else{

    #insert user into database#

    $result    mysql_query("SELECT email FROM guests WHERE email='$email'") or die ("couldnt find $database.$table"); 
    $rec_num    mysql_num_rows($result); 
    if (
    $rec_num!=0)
                {

    $name strtolower ($name);
    $name ucwords ($name);
    $postcode strtoupper ($postcode);
    $postcode ucwords ($postcode);
    $address ucwords ($address);
    $address str_replace (", , ",", ",$address);
    $telephonenumber str_replace (" """$telephonenumber);
    $telephonenumber str_replace ("-"""$telephonenumber);
    $telephonenumber trim ($telephonenumber);
    $name $firstname." ".$lastname;
    $address $addressline1.", ".$addressline2.", ".$city.", ".$county.", ".$postcode;
    $date date("d.m.Y");
    $time date("h:ia");

    #update db#
    mysql_query ("INSERT INTO `guests` (`id`, `refer`, `email`, `name`, `address`, `country`, `telephone`, `time`, `date`) VALUES ('', '$refer', '$email', '$name', '$address', '$country', '$telephone', '$time', '$date');"
    $error .= "New user registration completed. You have been emailed your password.<br>\n";

    $sucess=1;
                }else{
    #email already registered#
    $error .= "This email address has already been registered.<br>\n";
                }
        }

        }

    $form_complete="1";
    }

    ?>
    Cheers,
    Chris

  2. #2
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    your error is a misplaced semicolon on the line above. Try this:
    PHP Code:
    mysql_query ("INSERT INTO `guests` (`id`, `refer`, `email`, `name`, `address`, `country`, `telephone`, `time`, `date`) VALUES ('', '$refer', '$email', '$name', '$address', '$country', '$telephone', '$time', '$date')"); 

    $error .= "New user registration completed. You have been emailed your password.<br>\n"
    Aaron
    Aaron Brazell
    Technosailor



  3. #3
    Ceci n'est pas Zoef Zoef's Avatar
    Join Date
    Nov 2002
    Location
    Malta
    Posts
    1,111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Not an answer to your question, Sketch already did that.

    Just couldn't help noticing that your email validation regex will not validate a .info address.

    {2,3,4} <- should do it.

    Greetings

    Rik
    English tea - Italian coffee - Maltese wine - Belgian beer - French Cognac


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •