Proposing SQL Statement Coverage Metrics: Difference between revisions

Line 39: Line 39:


<code>
<code>
//for simplicity, this example is given in PHP.  
  //for simplicity, this example is given in PHP.  
//first, extract the input values from the form  
  //first, extract the input values from the form  
$username = $_POST[‘username’];  
  $username = $_POST[‘username’];  
$password = $_POST[‘password’];  
  $password = $_POST[‘password’];  
//query the database for a user with username/pw  
  //query the database for a user with username/pw  
$result = mysql_query(  
  $result = mysql_query(  
  “select * from users where username =  
  “select * from users where username =  
  ‘$username’ AND password = ‘$password’”);  
  ‘$username’ AND password = ‘$password’”);