Results 1 to 5 of 5

Thread: unexpected T_STRING error

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    101

    unexpected T_STRING error

    I Seem to be getting this error:
    Parse error: syntax error, unexpected T_STRING in C:\Inetpub\vhosts\foreverms.com\httpdocs\register_do.php on line 4

    PHP Code:
    <?php
    include 'config.php'
    // Connects to your Database
    mysql_connect($host['server'], $host['username'], $host['password']) or die(mysql_error());
    mysql_select_db($host['database']) or die(mysql_error());

    //This code runs if the form has been submitted
    if (isset($_POST['submit'])) {

    //This makes sure they did not leave any fields blank
    if (!$_POST['name'] | !$_POST['pass'] | !$_POST['pass2'] | !$_POST['pin'] | !$_POST['gender'] ) {
    die(
    'You did not complete all of the required fields');
    }

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

    //if the name exists it gives an error
    if ($check2 != 0) {
    die(
    'Sorry, the username '.$_POST['name'].' is already in use.');
    }

    // this makes sure both passwords entered match
    if ($_POST['pass'] != $_POST['pass2']) {
    die(
    'Your passwords did not match. ');
    }

    // here we encrypt the password and add slashes if needed
    $_POST['pass'] = md5($_POST['pass']);
    if (!
    get_magic_quotes_gpc()) {
    $_POST['pass'] = addslashes($_POST['pass']);
    $_POST['name'] = addslashes($_POST['username']);
    }

    // now we insert it into the database
    $insert "INSERT INTO users (username, password, pin, gender)
    VALUES ('"
    .$_POST['username']."', '".$_POST['pass']."' '".$_POST['pin']."' '".$_POST['pass']."' '".$_POST['gender']"')";
    $add_member mysql_query($insert);
    ?>


    <h1>Registered!</h1>
    <p>Thank you, you have registered - you may now login</a>.</p>

    Any ideal what the error is?

  2. #2
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: unexpected T_STRING error

    You forgot a semi-colon after your include() line:

    PHP Code:
    include('config.php'); 

  3. #3
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: unexpected T_STRING error

    You forgot a semicolon somewhere. You be told which line.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  4. #4
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: unexpected T_STRING error

    Quote Originally Posted by DigiRev
    You forgot a semi-colon after your include() line:

    PHP Code:
    include('config.php'); 
    Ahhh sorry; the beauty of quick reply. That's the second time I have replied and one of your posts has appeared
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  5. #5
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: unexpected T_STRING error

    PHP Code:
    mysql_query("INSERT [BEFORE] visualAd.."

Posting Permissions

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



Click Here to Expand Forum to Full Width