Modernvox Posted January 24, 2010 Share Posted January 24, 2010 Sorry guyz, a little ticked off at this point. For 2 days now, I have failed to get my registration page set up. I am wanting to check to see if username is already in use before adding the users registration. I keep getting the same error on line 20 unexpected ')' <?php if (isset($_POST['regname']) | $_POST['regstate'] | $_POST['regcity'] | $_POST['regemail'] | $_POST['username'] | $_POST['password'] | $_POST['confirmpass'])) $reg_name= $_POST['regname']; $reg_state= $_POST['regstate']; $reg_city= $_POST['regcity']; $reg_email= $_POST['regemail']; $reg_username= $_POST['username']; $reg_password= $_POST['password']; $reg_confirmpass= $_POST['confirmpass']; $database= "register"; $dbx =mysqli_connect("localhost", "", "") or die(‘Error connecting to MySQL server.’); mysql_select_db($database) or die( "Unable to select database"); $sql = "SELECT COUNT(*) FROM users WHERE username = '{$_POST['username']}'"; $sql_result = mysql_query($sql); if (mysql_result($sql_result, 0) > 0) { Echo "This username is already in use.Please choose another."; } else $query = "INSERT INTO users (reg_name, reg_state, reg_city, reg_email, reg_username, reg_password, reg_confirmpass) VALUES ('regname', $regstate', 'regcity', 'regemail', 'username', 'password', 'confirmpass')"; ?> My brain is total goo at this point Quote Link to comment https://forums.phpfreaks.com/topic/189582-wtf-wtf-and-wtf-some-more/ Share on other sites More sharing options...
PFMaBiSmAd Posted January 24, 2010 Share Posted January 24, 2010 The error you are listing for line 20 actually occurs on line 4 of what you posted, because there is an extra ) on the end of line 4. You also have a couple of smart/curly-quotes in the following (you must have copy pasted that from a word processor, rather than a programming editor) - or die(‘Error connecting to MySQL server.’); Quote Link to comment https://forums.phpfreaks.com/topic/189582-wtf-wtf-and-wtf-some-more/#findComment-1000660 Share on other sites More sharing options...
laffin Posted January 24, 2010 Share Posted January 24, 2010 There is no extra ')', but its a misuse of the isset function, but line 4 does have a problem, no beginning curly brace after the if statement Quote Link to comment https://forums.phpfreaks.com/topic/189582-wtf-wtf-and-wtf-some-more/#findComment-1000678 Share on other sites More sharing options...
Modernvox Posted January 24, 2010 Author Share Posted January 24, 2010 The error you are listing for line 20 actually occurs on line 4 of what you posted, because there is an extra ) on the end of line 4. You also have a couple of smart/curly-quotes in the following (you must have copy pasted that from a word processor, rather than a programming editor) - or die(‘Error connecting to MySQL server.’); ? Don't quite understand what your implying Quote Link to comment https://forums.phpfreaks.com/topic/189582-wtf-wtf-and-wtf-some-more/#findComment-1000681 Share on other sites More sharing options...
wildteen88 Posted January 24, 2010 Share Posted January 24, 2010 The use of isset is incorrect here if (isset($_POST['regname']) | $_POST['regstate'] | $_POST['regcity'] | $_POST['regemail'] | $_POST['username'] | $_POST['password'] | $_POST['confirmpass'])) You should read up on the proper use of isset. Your not listing your variables properly, you should separate each variable with a coma not a pipe character. Also statements which span multiple lines must be wrapped in curly braces {}. Read up on the use of if Quote Link to comment https://forums.phpfreaks.com/topic/189582-wtf-wtf-and-wtf-some-more/#findComment-1000768 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.