Results 1 to 2 of 2

Thread: Parse error: syntax error, unexpected T_ECHO

Hybrid View

  1. #1
    Join Date
    Aug 2009

    Exclamation Parse error: syntax error, unexpected T_ECHO

    Hey All,

    I'm very new to PHP, and am a young guy at that (16), no don't get me wrong I'm a smart kid, I just need time to perfect my skills

    Anyhow, the following the the script I wrote. Here's basically what I'm trying to do:

    1) A user, in a previous HTML page has inputted data into a form
    2) They press submit and the data SHOULD be processed through a PHP form
    3) I want that data to be entered into a database table. The database and table are fully set up.
    4) The script will have created the user and the user will now be able to login.

    www.mobitek.ca/createuser-builder/formto.html is the form, and there the insert fails, as per the error that was echoed.

    Here's the script:
    PHP Code:

    $password $_POST["password"];
    $name $_POST["name"];
    $address1 $_POST["address1"];
    $address2 $_POST["address2"];
    $city $_POST["city"];
    $state $_POST["state"];
    $zip $_POST["zip"];
    $country1 $_POST["country1"];
    $phone $_POST["phone"];
    $email $_POST["email"];
    $admin $_POST["admin"];
    $country2 $_POST["country2"];

    $link mysql_connect('localhost''mobitek_build'

    if (!
    $link) {
    'Could not connect: ' mysql_error());
    'Connected successfully';

    $query "INSERT INTO compb_users ( id , username , 

    password , name, address , city , state , zip , country1 , phone 

    , email , admin , country2 )
    VALUES (
    $id', '$username', '$password', '$name', '$address', '$city', 

    $state', '$zip', '$country1', '$phone', '$email', '$admin', 


    mysql_query($query) or die ('Error creating user')

    "Thank you";

    Thanks for the help in advance, Justin.

  2. #2
    Join Date
    Aug 2004
    Missing semi-colon on the preceding line (right before the last echo).

    Tip: an "Unexpected [something]" error often means the actual error is before the line number cited in the error message. That line number and message just tells you where the parser got confused and "gave up."
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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