Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder googleit's Avatar
    Join Date
    Jul 2006
    Location
    birmingham, uk
    Posts
    189
    Thanks
    0
    Thanked 0 Times in 0 Posts

    problem with my register code

    hmm
    why do i get this erro when i run this code?
    Code:
    Parse error: parse error, unexpected $ in /home/content/b/r/a/site/html/Coding zone/register.php on line 47
    this is my code can you see any errors?
    PHP Code:
    mysql_connect("host""username""pass") or die(mysql_error());
    mysql_select_db("dbname") or die(mysql_error());


    if (isset(
    $_POST['submit'])) {

    if (!
    $_POST['username'] | !$_POST['pass'] | !$_POST['pass2'] ) {
    die(
    'You did not complete all of the required fields');
    }


    if (!
    get_magic_quotes_gpc()) {
    $_POST['username'] = addslashes($_POST['username']);
    }
    $usercheck $_POST['username'];
    $check mysql_query("SELECT username FROM users WHERE username = '$usercheck'")
    or die(
    mysql_error());
    $check2 mysql_num_rows($check);


    if (
    $check2 != 0) {
    die(
    'Sorry, the username '.$_POST['username'].' is already in use.');
    }

    if (
    $_POST['pass'] != $_POST['pass2']) {
    die(
    'Your passwords did not match.');
    }


    $_POST['pass'] = md5($_POST['pass']);
    if (!
    get_magic_quotes_gpc()) {
    $_POST['pass'] = addslashes($_POST['pass']);
    $_POST['username'] = addslashes($_POST['username']);
    }


    $insert "INSERT INTO users (username, password)
    VALUES ('"
    .$_POST['username']."', '".$_POST['pass']."')";
    $add_member mysql_query($insert); 

  • #2
    Regular Coder musher's Avatar
    Join Date
    Jan 2005
    Location
    Minnesota
    Posts
    203
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Which line is line 47 in your code (post line 47 and line above)
    Thanks
    Jim M

    "Lord, help me to become the person my dog thinks I am" - Dawn Ewing
    "If you must know. Yes, I do enjoy running after the dog sled when I fall off" - Me

    www.huskyzone.com -- Woodland Siberians

  • #3
    Regular Coder googleit's Avatar
    Join Date
    Jul 2006
    Location
    birmingham, uk
    Posts
    189
    Thanks
    0
    Thanked 0 Times in 0 Posts
    its now saying erro on line 60 but there is nothing on line 60 here is what is on line 47
    PHP Code:
    $insert "INSERT INTO users (username, password)
    VALUES ("
    .$_POST['username']."', '".$_POST['pass'].")";
    $add_member mysql_query('$insert'); 

  • #4
    Regular Coder musher's Avatar
    Join Date
    Jan 2005
    Location
    Minnesota
    Posts
    203
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by googleit
    its now saying erro on line 60 but there is nothing on line 60 here is what is on line 47
    PHP Code:
    $insert "INSERT INTO users (username, password)
    VALUES ("
    .$_POST['username']."', '".$_POST['pass'].")";
    $add_member mysql_query('$insert'); 
    Try this, looks like your missing a couple of '
    PHP Code:
    "INSERT INTO users (username, password)  VALUES ('".$_POST['username']."', '".$_POST['pass']."'"
    Thanks
    Jim M

    "Lord, help me to become the person my dog thinks I am" - Dawn Ewing
    "If you must know. Yes, I do enjoy running after the dog sled when I fall off" - Me

    www.huskyzone.com -- Woodland Siberians

  • #5
    Regular Coder googleit's Avatar
    Join Date
    Jul 2006
    Location
    birmingham, uk
    Posts
    189
    Thanks
    0
    Thanked 0 Times in 0 Posts
    nope that doesnt work any other ideas?

  • #6
    Regular Coder musher's Avatar
    Join Date
    Jan 2005
    Location
    Minnesota
    Posts
    203
    Thanks
    0
    Thanked 0 Times in 0 Posts
    try previous post and this
    PHP Code:
    $add_member mysql_query($insert); 
    Thanks
    Jim M

    "Lord, help me to become the person my dog thinks I am" - Dawn Ewing
    "If you must know. Yes, I do enjoy running after the dog sled when I fall off" - Me

    www.huskyzone.com -- Woodland Siberians

  • #7
    Regular Coder googleit's Avatar
    Join Date
    Jul 2006
    Location
    birmingham, uk
    Posts
    189
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks that got it


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •