title: How can I test my PHP MySQL injection example?
body: <p>I want to use PHP/Mysql injection with a login example, my code is below.</p>
  
  <p>I have tried with a username of <code>anything' --</code> and an empty password but it doesn't work and I couldn't log in.</p>
  
  <p>Could anyone help me?</p>
  
  <pre><code>&lt;?php
  mysql_connect('localhost','root','root');
  mysql_select_db('hp');
  ?&gt;
  
  &lt;form action="" method="post"&gt;
  &lt;table width="50%"&gt;
      &lt;tr&gt;
          &lt;td&gt;User&lt;/td&gt;
          &lt;td&gt;&lt;input type="text" name="user"&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type="text" name="password"&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
      &lt;input type="submit" value="OK" name="s"&gt;
  &lt;/form&gt;
  
  &lt;?php
  if($_POST['s']){
      $user = $_POST['user'];
      $pass = $_POST['password'];     
      $re = mysql_query("select * from zend_adminlist where user_name = '$user' and password = '$pass'");
  
      if(mysql_num_rows($re) == 0){       
          echo '0';
      }else{
          echo '1';
      }
  }
  ?&gt;
  </code></pre>