Php Parse Error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Leen
    New Member
    • Aug 2010
    • 22

    Php Parse Error

    Hello, please if u can help me, I am working on project developing a website.
    I write the sign up page but the server gives me a parse error. please notify what it is?
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <?php
    $fname=$_POST["nom"];
    $lname=$_POST["prenom"];
    $pname=$_POST["perenom"];
    $ddn=$_POST["dob"];
    $tel=$_POST["phone"];
    $ema=$_POST["mail"];
    $vil=$_POST["ville"];
    $ru=$_POST["rue"];
    $imm=$_POST["immeuble"];
    $idc=$_POST["idcard"];
    $pofs=$_POST["pps"];
    $uname=$_POST["userNom"];
    $pwd=$_POST["pass"];
    include("MySQLConnection.php");
    $insert="INSRET INTO etudiante values(", "$fname", "$lname", "$pname", "$ddn", "$tel", "$ema", "$vil", "$ru",
     "$imm", "$idc", "$pofs","$uname", MD5('$pwd'))";
     $result= mysql_query($insert);
     if($result)
     {
     	header("Location:Acceptance.php");
     }
     else
     {
     	echo("You have missing or wrong input infomation". mysql_error());
     }
     mysql_close();
     ?>
    thanks for your help
    Last edited by Atli; Aug 15 '10, 09:57 AM. Reason: Please use [code] tags when posting code.
  • zorgi
    Recognized Expert Contributor
    • Mar 2008
    • 431

    #2
    Hi there

    Your error is probably coming from this line:

    Code:
    $insert="INSRET INTO etudiante values .....
    But I think the best place for you to start would be this tutorial:

    Comment

    • Leen
      New Member
      • Aug 2010
      • 22

      #3
      i know the error in this line but what is it? and why??

      Comment

      • zorgi
        Recognized Expert Contributor
        • Mar 2008
        • 431

        #4
        From php Manual:

        resource mysql_query ( string $query [, resource $link_identifie r ] )

        As you can see it needs parameter $query of type string. Your variable $insert is not well defined string so apart from above mentioned tutorial you need to understand strings in php and quotes within the string. I googled a bit and found this tutorial that looks simple enough:

        Oooops, looks like the page you requested could not be found. Please check the URL for proper spelling and capitalization.


        Study this few links I gave you. Once you understand them you will be able to fix your code. After that you should look into validating user input and properly escaping special characters in a string for use in an SQL statement.

        Comment

        • Tasim
          New Member
          • Aug 2010
          • 2

          #5
          Hi
          Please check you query. There is an inverted comma mis use problem. Use the following query:


          $INSERT = "INSRET INTO etudiante values('', '$fname', '$lname', '$pname', '$ddn', '$tel', '$ema', '$vil', '$ru', '$imm', '$idc', '$pofs', '$uname', 'MD5($pwd)')";

          I will definitely works.

          Comment

          • johny10151981
            Top Contributor
            • Jan 2010
            • 1059

            #6
            Even though the answer is given, I want to suggest a little to developer...

            you have used 12 post value
            Code:
             
             $fname=$_POST["nom"];
             $lname=$_POST["prenom"];
             ...
             ...
            The fact that is interesting is you have used in every case post data name and php variable name is different. Of course nothing wrong with that.

            but if you use same name in the both field that is very helpful

            Code:
             
             $fname=$_POST["fname"];
             $prenom=$_POST["prenom"];
             ...
             ...
            I have seen when number of data increase(in your case 12) its become difficult to handle all data specially when you would discover that you have misused a varisble.

            Comment

            Working...