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 6 of 6

Thread: error in code

  1. #1
    Registered User
    Join Date
    Apr 2006
    Posts
    88
    Thanks
    0
    Thanked 0 Times in 0 Posts

    error in code

    Ok,
    I have a form that lets people sign up for my services, then it gets inserted into a MYSQL database. The person fills out the form thens submits, but there is an error on the form action page. On line 50
    Here is the code.

    PHP Code:
    <?
    $user
    ="databaseuser";
    $password="databasepass";
    $database="databasename";
    $host="localhost";
     
    $first=$_POST['firstname'];
    $last=$_POST['lastname'];
    $email=$_POST['email'];
    $phone=$_POST['phone'];
    $mobile=$_POST['mobile'];
    $address=$_POST['address'];
    $city=$_POST['city'];
    $state=$_POST['state'];
    $zip=$_POST['zip'];
     
    mysql_connect($host,$user,$password);
    @
    mysql_select_db($database) or die( "Unable to select database");
     
    $query"INSERT INTO contacts VALUES('','$first','$last','$email','$phone','$mobile','$address','$city','$state','$zip')";
    mysql_query($query);
     
    echo(
    "Thank you for signing up. You will recieve an email when your submision is reviewed.")
     
    mysql_close()    <---line 50
    ?>
    the form is at http://www.surfacehawaii.com/kylecal...ges/signup.php

  • #2
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    you're missing a ; on the previous line.

    In future, including the error message will help people help you...
    My thoughts on some things: http://codemeetsmusic.com
    And my scrapbook of cool things: http://gjones.tumblr.com

  • #3
    Super Moderator JohnDubya's Avatar
    Join Date
    Nov 2006
    Location
    Missouri
    Posts
    634
    Thanks
    12
    Thanked 18 Times in 18 Posts
    Not only that, you need a ; after mysql_close() as well.

  • #4
    Registered User
    Join Date
    Apr 2006
    Posts
    88
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks lol

  • #5
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    Quote Originally Posted by JohnDubya View Post
    Not only that, you need a ; after mysql_close() as well.
    I'll be honest and say I did miss that one, but the last line of code doesn't actually need a ; for things to work. I wouldn't reccomend doing it intentionally though, it's likely to lead to headaches should you come back and add more lines
    My thoughts on some things: http://codemeetsmusic.com
    And my scrapbook of cool things: http://gjones.tumblr.com

  • #6
    Registered User
    Join Date
    Apr 2006
    Posts
    88
    Thanks
    0
    Thanked 0 Times in 0 Posts
    new problem
    now it is: Parse error: parse error, unexpected T_STRING in /homepages/0/d176381271/htdocs/kylecaleb/packages/insert.php on line 43

    Line 43 is
    mysql_connect($host,$user,$password);

    I am getting confused


  •  

    Posting Permissions

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