master82 Posted August 17, 2006 Share Posted August 17, 2006 Here is my register code - I get the data from a form (POST command).But im getting this error message:[b]Fatal error[/b]: Only variables can be passed by reference in [b]site root here\addnewuser.php [/b]on line [b]18[/b]that being:[code]end("Username already in use - Try another");[/code]Full script:[code]<?phpsession_start();$ip = ($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];require_once("dbconfig.php");if($_POST['username']){$username=$_POST['username'];$username=str_replace(array("<", ">"), array("<", ">"), $username);$qry=mysql_query("SELECT * FROM users WHERE username='{$username}'",$conn);if(mysql_num_rows($qry)){end("Username already in use - Try another");}else if($_POST['password'] != $_POST['verify']){end("The passwords did not match - Try again");}else{mysql_query("INSERT INTO users (HIDDEN FIELDS) VALUES(HIDDEN VALUES)", $conn);header("Location: login.php");}}else{end("Something went wrong - Try again");}?>[/code]Thankd in advance for any help you can give... Quote Link to comment Share on other sites More sharing options...
makeshift_theory Posted August 17, 2006 Share Posted August 17, 2006 Don't know if it will make a different but:Change:$qry=mysql_query("SELECT * FROM users WHERE username='{$username}'",$conn);to$qry=mysql_query("SELECT * FROM users WHERE username='$username'",$conn);The Braces are unnecessary. Quote Link to comment Share on other sites More sharing options...
fenway Posted August 18, 2006 Share Posted August 18, 2006 You should check mysql_error(). Quote Link to comment 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.