0 Replies Latest reply on Mar 11, 2012 9:11 AM by St3ph3n31

    can't connect php reg form to database ??

    St3ph3n31 Level 1

      Hi guys hope you can help ?? for some reason I can't get this to register details to the database, all the checks work .. password, to long etc , no syntax errors either?

       

      I'm using wamp 2.2 

      many thanks in advance for taking the time

       

      <?php

      error_reporting (E_ALL ^ E_NOTICE);

         

       

       

      $submit = strip_tags ($_POST['submit']);

       

      $fullname = strip_tags ($_POST['fullname']);

       

      $username =strip_tags ($_POST['username']);

       

      $password =strip_tags($_POST['password']);

       

      $repeatpassword =strip_tags($_POST ['repeatpassword']);

       

      $date = date("D-M-Y");

       

      if ($submit)

      {

         //check for exsitance

         if ($fullname&&$username&&$password&&$repeatpassword)

      {

         if ($password==$repeatpassword)

         {

           // check charcacter length of username and fullname

      if  (strlen($username)>25||strlen($fullname)>25)

      {

           echo  "length of username or full name is too long!";

      }

        else

        {

          // check password length

          if (strlen($password)>25||strlen($password)<6)

          {

          echo "Password must be between 6 and 25 characters!";

          }

          else

          {

            // register the user database

           

            // encrypt password

            $password = md5($password);

            $repeatpassword = md5($repeatpassword);

       

       

            // open our database

            $connect = mysql_connect("localhost","root","");

            mysql_select_db("users"); //selects database

           

            $queryreg =mysql_query

                                                   (" INSERT INTO users1 VALUES  ('','$fullname','$username','$password','$date',) ");

       

            die ("You are now registered with Simply priceless ... Welcome! Click here <a href='Home.php'> to return to Home page</a> ");

       

          }

        }

       

         }

         else

             echo "Your passwords do not match";

      }

        else

            echo "Please fill in <b>all</b> fields marked with * ";

      }

      ?>