title: Display only the first 3 matching rows from a query via php PDO
body: <p>this is for a homework assigment. I am suppose to: Demonstrate use of the SQL LIMIT clause by displaying only the first 3 matching rows from a query.</p>
  
  <p>the "first 3 matching rows" part is throwing me off a bit. How do I match rows, or should I say find 3 matching rows. I know that in my table none of my rows 'match', its a simple table with 6 columns and 4 rows, I could add matching rows for demonstrating it.</p>
  
  <p>I would be doing this using the PDO method via php obviously while using the sql limit statment to make it only 3 rows.</p>
  
  <p>I figure a basis of the code would look something like this with a different sql statement.</p>
  
  <p><strong>php</strong></p>
  
  <pre><code>        $servername = "localhost";
          $username = "";
          $password = "";
          $dbname = "";
  
          try {
              $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
              // set the PDO error mode to exception
              $conn-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  
              // sql to delete a record
              $sql = "****select * from teams where 3 rows match****";
  
              // use exec() because no results are returned
              $stmt = $conn-&gt;prepare($sql);
              $stmt-&gt;execute()
          }
          catch(PDOException $e)
              {
              echo $sql . "&lt;br&gt;" . $e-&gt;getMessage();
              }
  
          $conn = null;
      }
  </code></pre>