title: Creating Login/register system in php but nothing shows in mysql database phpmyadmin
body: <p>So actualy the problem is i need a login/register system and thast what i wrote and it works all fine login and register is working except when i try to create account i write in all the things its needed and create it and it says You've succsessfully registered! but when i go check the database there isnt the new data with id username pass and so on but i get no error connecting to database or anything and when i try to login i cant cuz there are no data from registering in database. I also checked the database name twice and its not wrong in the code i think or it is i m kinda new in php.</p>
  
  <p><strong>if anyone wants i can add him on skype or you can check over teamviewer if u prefer i rly need this fixed please!!</strong></p>
  
  <p>picture of the database: <a href="http://shrani.si/f/1f/pO/3sIbCuUk/brez-naslova.png" rel="nofollow">http://shrani.si/f/1f/pO/3sIbCuUk/brez-naslova.png</a> cant post pictures directly yet</p>
  
  <p>Database server</p>
  
  <pre><code>Server: 127.0.0.1 via TCP/IP
  Server type: MySQL
  Server version: 5.6.14 - MySQL Community Server (GPL)
  Protocol version: 10
  User: root@localhost
  Server charset: UTF-8 Unicode (utf8)
  </code></pre>
  
  <p>Web server</p>
  
  <pre><code>Apache/2.4.7 (Win32) OpenSSL/1.0.1e PHP/5.5.6
  Database client version: libmysql - mysqlnd 5.0.11-dev - 20120503 
  PHP extension: mysqli Documentation
  </code></pre>
  
  <p><strong>this is my register.php file</strong></p>
  
  <pre><code>echo "&lt;h1&gt;Sign Up&lt;/h1&gt;";
  
  $submit = @$_POST['submit'];
  
  //form data
  $fullname = strip_tags(@$_POST['fullname']);
  $username = strip_tags(@$_POST['username']);
  $password = strip_tags(@$_POST['password']);
  $confirmpassword = strip_tags(@$_POST['confirmpassword']);
  $date = date("Y-m-d");
  
  if($submit)
  {
  //check for existance
      if($fullname&amp;&amp;$username&amp;&amp;$password&amp;&amp;$confirmpassword)
      {
          if($password==$confirmpassword)
          {
              if (strlen($username)&gt;25||strlen($fullname)&gt;25)
              {
                  echo "Lenght of username or full name is too long!"; 
              }
              else
              {
                  if(strlen($password)&gt;25||strlen($password)&lt;6)
                  {
                      echo "Your password must be between 6 and 25 characters long!";
                  }
                  else
                  {
                      //register the user
                      //encrypt password
                      $password = md5($password);
                      $confirmpassword = md5($confirmpassword);
                      //connect to databases
                      $connect = mysql_connect("localhost", "root", "");
                      mysql_select_db("login");
  
                      $queryreg = mysql_query("INSERT INTO users VALUES   ('','$fullname','$username','$password','$date'");
  
                      die("You've succsessfully registered! &lt;a href='index2.php'&gt;Click here to return to the login page!&lt;/a&gt;");
  
                  }
              }
          }
          else
          {
              echo "Your passwords do not match!";
          }
      }
      else
      {
          echo "Please enter all fields!";
      }
  }
  
  ?&gt;
  
  
  &lt;p&gt;
  &lt;form action="register.php" method="POST"&gt;
      &lt;table&gt;
          &lt;tr&gt;
              &lt;td&gt;
              Full Name: 
              &lt;/td&gt;
              &lt;td&gt;
                  &lt;input type="text" name="fullname" value="&lt;?php echo $fullname?&gt;"&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;
              Username: 
              &lt;/td&gt;
              &lt;td&gt;
                  &lt;input type="text" name="username" value="&lt;?php echo $username ?&gt;"&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;
              Password: 
              &lt;/td&gt;
              &lt;td&gt;
                  &lt;input type="password" name="password"&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;
              Confirm Password: 
              &lt;/td&gt;
              &lt;td&gt;
                  &lt;input type="password" name="confirmpassword"&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
      &lt;p&gt;
          &lt;input type="submit" name="submit" value="Create Account"&gt; 
      &lt;/p&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>thats my index2.php i named it index2.php cuz i arleady have 1 index.php</strong></p>
  
  <pre><code>&lt;head&gt;
      &lt;title&gt;Login Session&lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
      &lt;form method="POST" action="login.php"&gt;
          Username: &lt;input type="text" name="username"&gt;&lt;br/&gt;
          Password: &lt;input type="password" name="password"&gt;&lt;br/&gt;
              &lt;input type="submit" name="submit" value="Log in"&gt;
              &lt;a href="register.php"&gt;Create An Account&lt;/a&gt;
              &lt;a href="index.php"&gt;Domov&lt;/a&gt;
      &lt;/form&gt;
  
  
  &lt;/body&gt;
  </code></pre>
  
  <p><strong>and here is login.php</strong></p>
  
  <pre><code>session_start();
  
  $username = $_POST['username'];
  $password = $_POST['password'];
  
  if ($username&amp;&amp;$password)
  {
  $connect = mysql_connect("localhost", "root", "") or die("Couldn't connect to host!");
  mysql_select_db("login") or die("Couldn't find database!");
  
  $query = mysql_query("SELECT * FROM users WHERE username ='$username'");
  
  $numrows = mysql_num_rows($query);
  if ($numrows!=0)
  {
      while ($row = mysql_fetch_assoc($query))
      {
          $dbusername = $row['username'];
          $dbpassword = $row['password'];
      }
  
      if($username==$dbusername&amp;&amp;md5($password)==$dbpassword)
      {
  
          $_SESSION['username']=$username;
          header("Location: member.php");
  
  
      }
      else
      {
          echo "Wrong password!";
      }
  }
  else
  {
      die("That user hasn't been created!");
  
  }   
  }
  
  else 
  {
      echo "Username and password must be entered!";   
  }
  </code></pre>
  
  <p><strong>and member.php</strong></p>
  
  <pre><code>session_start();
  
  if ($_SESSION['username'])
      echo "Hello, ".$_SESSION['username']."!&lt;br/&gt;&lt;a href='logout.php'&gt;Sign Out";
  else 
  {
          header("Location: index2.php");
  }
  </code></pre>