title: MySQL SELECT statement using PHP GET variable
body: <p>I have a PHP script that is generating a MySQL select statement:</p>
  
  <p>select * from words where word = 'Classic'</p>
  
  <p>There is exactly one word in the words table with the variable word equal to Classic.</p>
  
  <p>When my PHP page executes, I get no results from the query. If I echo the string that is being used to execute the query, cut and paste that into the SQL window in PHPMyAdmin in the database, I also get no results. However, if I re-type that EXACT string into the SQL window in PHPMyAdmin (with the same quote characters), I get the proper result of one row.</p>
  
  <p>The word Classic from the select statement is gotten from a PHP GET (see code below). I can echo the $word variable, and get the correct result of 'Classic'. What am I doing wrong?</p>
  
  <p>Here is my code:</p>
  
  <pre><code>&lt;?php
  
    require ('dbconnect.php');
  
    $word = $_GET["word"];
  
    $selectStr = "SELECT * FROM words WHERE word = '" . $word . "'";
  
    if ($results = MySQL($dbName, $selectStr))
    {
      $rowCount = MySQL_NUMROWS($results);
    }
  
    $resultRow = MYSQL_FETCH_ROW($results);
  
    $wordID = $resultRow[0];
  
  ?&gt;
  </code></pre>