Advanced Search

Results 1 to 3 of 3

Thread: Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';'

  1. #1
    Join Date
    Feb 2010
    Posts
    21
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';'

    can any one check what is the wrong in this code...


    <?php
    include 'conifig.php';
    echo $Loginname='$_GET["Loginname"];
    $pass=$_GET["pass"];
    $query = "SELECT * FROM table WHERE Loginname="$Loginname"";
    $result = mysql_query($query, $con);
    if ($result['flag']==0)
    {
    $sql="UPDATE table SET flag=1 WHERE Loginname=$Loginname";

    echo "hi";
    //header('Location:login.html');
    }
    else
    {
    echo "your activation is incomplete please activate your link by activation link";
    }
    if (!mysql_query($sql,$con))
    {
    die('Error: ' . mysql_error());
    }
    mysql_close($con);
    ?>

    any suggestions please

  2. #2
    Join Date
    Sep 2008
    Location
    Bristol - UK
    Posts
    842
    Thanks
    32
    Thanked 132 Times in 131 Posts

    Default

    You've put an apostrophe before the get variable, making PHP think it's a string. Syntax highlighting would have helped you see this very easily:

    PHP Code:
    <?php
    include 'conifig.php';
    echo 
    $Loginname$_GET["Loginname"];
    $pass=$_GET["pass"];
    $query "SELECT * FROM table WHERE Loginname= '" $Loginname "' ";
    $result mysql_query($query$con);
    if (
    $result['flag']==0)
    {
    $sql="UPDATE table SET flag=1 WHERE Loginname=$Loginname";

    echo 
    "hi";
    //header('Location:login.html');
    }
    else
    {
    echo 
    "your activation is incomplete please activate your link by activation link";
    }
    if (!
    mysql_query($sql,$con))
    {
    die(
    'Error: ' mysql_error());
    }
    mysql_close($con);
    ?>
    Also you didn't put the variable in a string in the query.

  3. #3
    Join Date
    Feb 2010
    Posts
    21
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    hi this is not working i have tried it
    i am getting an error that
    Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''lkjhgfsjd' at line 1.

    to get an idea i will send u my before page code plz check it .


    <?php
    include 'conifig.php';
    $pass=md5($_POST[password]);
    $sql="INSERT INTO table
    VALUES ('','$_POST[firstname]','$_POST[lastname]','$_POST[middlename]','$_POST[radio]' ,'$_POST[loginname]','$pass',
    '$_POST[dateofbirth]','$_POST[address1]','$_POST[address2]','$_POST[state]','$_POST[city]','$_POST[country]','$_POST[pincode]','$_POST[mailid]','$_POST[answer1]','$_POST[answer2]','$_POST[answer3]','')";
    if (mysql_query($sql,$con))
    {
    $to = $_POST[mailid];
    $subject = "Activation conformation";
    $message = " Hello!
    Your Account Has Been Created With The Following Login Credentials
    Login Name ='$_POST[loginname]'
    Password ='$pass'
    thank u for siging up please click the following link to activate your account
    http://pro.server.com/zee_000/verifyregister.php?Loginname='$_POST[loginname]' & password='$pass'";
    $from = "something@something.com";
    $headers = "From: $from";
    mail($to,$subject,$message,$headers);
    echo "Mail Sent.";
    }
    else
    {
    die('Error: ' . mysql_error());
    }

    echo"1 Record Is Added";

    mysql_close($con);
    ?>

Bookmarks

Posting Permissions

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