supermerc Posted February 12, 2008 Share Posted February 12, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/90793-registration-form-problem/ Share on other sites More sharing options...
phpSensei Posted February 12, 2008 Share Posted February 12, 2008 edit: nvm Quote Link to comment https://forums.phpfreaks.com/topic/90793-registration-form-problem/#findComment-465381 Share on other sites More sharing options...
phpSensei Posted February 12, 2008 Share Posted February 12, 2008 You didnt Set the column names, please just try to look up it first... INSERT INTO table_name (column1, column2,...) VALUES (value1, value2,....) Quote Link to comment https://forums.phpfreaks.com/topic/90793-registration-form-problem/#findComment-465386 Share on other sites More sharing options...
kishanforum Posted February 12, 2008 Share Posted February 12, 2008 The problem is here mysql_query("SELECT username FROM users WHERE username = '{$user'}"); write like mysql_query("SELECT username FROM users WHERE username = '{$user}' "); Quote Link to comment https://forums.phpfreaks.com/topic/90793-registration-form-problem/#findComment-465389 Share on other sites More sharing options...
phpSensei Posted February 12, 2008 Share Posted February 12, 2008 edit: nvm already posted Quote Link to comment https://forums.phpfreaks.com/topic/90793-registration-form-problem/#findComment-465390 Share on other sites More sharing options...
supermerc Posted February 12, 2008 Author Share Posted February 12, 2008 okay now im getting Parse error: syntax error, unexpected '}' in /home/randomy/public_html/yourplace/proceed.php on line 63 Quote Link to comment https://forums.phpfreaks.com/topic/90793-registration-form-problem/#findComment-465392 Share on other sites More sharing options...
php_dave Posted February 12, 2008 Share Posted February 12, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/90793-registration-form-problem/#findComment-465400 Share on other sites More sharing options...
supermerc Posted February 13, 2008 Author Share Posted February 13, 2008 its okay now Im not getting anymore errors, but It isnt entering anything in the database except for the password Quote Link to comment https://forums.phpfreaks.com/topic/90793-registration-form-problem/#findComment-465410 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.