Page 1 of 1

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

Posted: Mon Dec 02, 2002 4:38 pm
by darthmahon
Hey,

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

Line 59 is this:

Code: Select all

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

Code: Select all

<?php 

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

if ($access_name=="") &#123;
$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>.";
&#125;else&#123; 
$title = "Hello $access_name, please click <a href=/members/welcome.php>here</a> to visit the distributors section.";
&#125;


$form_complete="";
if ($formsubmit==1) &#123;$formsubmit="";$sucess="";

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

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

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

else&#123;

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

#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)
            &#123;

$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;
            &#125;else&#123;
#email already registered#
$error .= "This email address has already been registered.<br>\n";
            &#125;
    &#125;

    &#125;

$form_complete="1";
&#125;

?>
Cheers,
Chris

Try here

Posted: Mon Dec 02, 2002 5:32 pm
by phpScott
mysql_query ("INSERT INTO `guests` (`id`, `refer`, `email`, `name`, `address`, `country`, `telephone`, `time`, `date`) VALUES ('', '$refer', '$email', '$name', '$address', '$country', '$telephone', '$time', '$date');")
Should be

Code: Select all

mysql_query ("INSERT INTO `guests` (`id`, `refer`, `email`, `name`, `address`, `country`, `telephone`, `time`, `date`) VALUES ('', '$refer', '$email', '$name', '$address', '$country', '$telephone', '$time', '$date')");
You just misplaced the semi-colon. Annoying I know because I often do the same thing(especial with the editor I am using putting both brackets on at the same time);

phpScott