How to fix Parse error in PHP code?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Qwaization
    New Member
    • Nov 2010
    • 1

    How to fix Parse error in PHP code?

    Hello all
    I am trying to create registration form. I am using wampserver 2.0. The code I am using is below. I am trying to fix that problem but I can't. Any help would be appreciated.

    Error:
    Parse error: parse error in C:\wamp\www\reg .php on line 20

    Code:
    <?php
    if(isset($_POST['reg'])){
    $name = strlen($_POST['nickas']);
    if($name <= 3){
    print "Prisijungimo vardo ilgis turi buti ne mazesnis nei 3 simboliai!!!";
    }else{
    if($_POST['e-mail'] == ""){
    print "Neivestas e-mailas!!!";
    }else{
    if($_POST['password'] == ""){
    print "Neivedei slaptazodzio!!!";
    }else{
    if($_POST['password'] != $_POST['password2']){
    print "Slaptazodziai mesutampa!!!";
    }else{	
    require "connect.php";
    $pass = md5($_POST['password']);
    $data = date("Y-m-d H-i-s");
    mysql_query("INSERT INTO `users` (nickas,e-mail,password,data)
    //error is here
    VALUES (`".$_POST['nickas']."`, '"$_POST['e-mail']."', '$pass'", '$data'")");
    print "Uzsiregistravai sekmingai!!!"
    }
    
    }
    }
    }
    }
    ?>
    <form action="reg.php" method="post" />
    Prisijungimo vardas:
    <input type="text" name="nickas" /><br>
    Slaptazodis:
    <input type="password" name="password" /><br>
    Slaptazodzio pakartojimas:
    <input type="password" name="password2" /><br>
    E-mailas:
    <input type="text" name="e-mail" /><br>
    <input type="submit" name="reg" value="Toliau">
    </form>
    connect.php code is:
    Code:
    <?php
    $prisijungimas = mysql_connect("localhost", "root", "***") or die ("Klaida.")
    mysql_select_db("duomenubaze");
    ?>
    Last edited by Dormilich; Nov 22 '10, 07:09 AM.
  • sidhx
    New Member
    • Dec 2009
    • 50

    #2
    hey look on this line
    VALUES (`".$_POST['nickas']."`, '"$_POST['e-mail']."', '$pass'", '$data'")"); change this to
    VALUES ('".$_POST['nickas']."', '".$_POST['e-mail']."', "'.$pass.'" , "'.$data.'" )");

    Comment

    Working...