www.webdeveloper.com
Results 1 to 2 of 2

Thread: Parse error: syntax error, unexpected T_ECHO

Hybrid View

  1. #1
    Join Date
    Aug 2009
    Posts
    1

    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:
    <?php

    $username 
    $_POST["username"];
    $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'

    'PASSWORD');
    if (!
    $link) {
        die(
    'Could not connect: ' mysql_error());
    }
    echo 
    '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', 

    '
    $country2')";

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

    echo 
    "Thank you";

    ?>
    Thanks for the help in advance, Justin.

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,637
    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."
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

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



Recent Articles