Jump to content

registration form problem


supermerc

Recommended Posts

Hey, I have this code to process the information and enter it in the database but im getting this error:

 

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting '}' in /home/randomy/public_html/yourplace/proceed.php on line 49

 

<?php
//NOTE: if you come from the previous part of this tutorial you don't need
//to add these variable declarations.
//Here we assign some values to some variables, using the values sent by a
//form you must have previously created $user = $_POST['username'];//get username from form
$pass = $_POST['password'];//get password from form
$pass2 = $_POST['password2'];//get password2 from form
$name = $_POST['name'];//get name from form
$domain = $_POST['domain'];//get domain from form
$zip = $_POST['zip'];//get zip from form
$city = $_POST['city'];//get city from form
$email = $_POST['email'];//get email from form
$state = $_POST['state'];//get state from form
$country = $_POST['country'];//get country from form
$address = $_POST['address'];//get address from form
$phone = $_POST['phone'];//get phone from form
//****************//
//Here we connect to the database, you have to use your own data.
//If you need a tutorial that explains you how to connect to a database just browse our php tutorials $connection = mysql_connect("mysqlhost", "databasename", "dbusername");
//now we choose the database to be used
@mysql_select_db(databasename) or die( "Unable to select database");
//here we declare our sql query statement to see if the user already exists
$check = mysql_query("SELECT username FROM users WHERE username = '{$user'}");
$returned = mysql_fetch_array($check);
//if a user with the same username is returned we redirect the users to a
//previously created error page
if(!empty($returned))
{
header("Location: error-userexists.php"); //the user will be sent to this page
mysql_close($connection); // and we close the connection to the database Die();
}
else
{
//here we declare our sql query statement to see if the email address is
//already associated to another account $check = mysql_query("select email from users where email="$email"");
$returned = mysql_fetch_array($check);
//if a user with the same email address is returned we redirect the users
//to a previously created error page, this check is performed to be sure
//that only one account per email is created
if(!empty($returned))
{
header("Location: error-emailexists.php"); //the user will be sent to this page
mysql_close($link); //and we close the connection to the database
Die();
}
else //if these checks go smooth
$pass=md5($pass); // we encrypt the passwotd with md5 function
//we declare our sql statement to insert the collected values into our database
$request = "INSERT INTO users values(NULL,'$name','$user','$pass', '$email','$domain','$zip','$city','$state','$country', '$address','$phone')";
$results = mysql_query($request);
if($results) //if this operation goes smooth we send the visitor to a
//previously created error page
{
header("Location: accountok.php"); //the user will be sent to this page
}
else //is any kind of issue is found {
header("Location: error-account.php");
//the user will be sent to
//this previously created page
}
mysql_close($link); // we close the connection
Die();
}
//****************// ?>

 

line 49 is

 

$request = "INSERT INTO users values(NULL,'$name','$user','$pass', '$email','$domain','$zip','$city','$state','$country', '$address','$phone')";

 

please help me

Link to comment
Share on other sites

Hi,

 

You have comments intertwining with code all over the shop - is that a direct copy and paste or a downloaded script?

 

I would revist where you got the script from and try and get an original copy - rather than a copy and paste as this cant be the original code layout..

 

Issues i have seen :

 

Line 5 :  $user = blah bah .. should be on its own line

Line 23: '{$user'}  should be '{$user}'

Line 34: more code hidden in comments

Line 45: missing {

Line 55: { is behind comment markers.

 

As I say - I think you should go and re check the original script and use something like textpad when editing or copying and pasting as whatever you have used seems to have corrupted the Line breaks.

 

HTH

Dave

 

 

 

 

 

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.