title: How to pass a php variable in WHERE clause of SELECT statement?
body: <p>I have a php variable that I want to fetch another field in database using this variable in my <em>where</em> clause.</p>
  
  <p>My code:</p>
  
  <pre><code>require("conn.php");
  $module = $_POST[ 'postmodule' ];
  $query = "SELECT width FROM modules WHERE code = $module";
  $result = mysqli_query($conn, $query);
  $row = mysqli_fetch_assoc($result);
  echo $row['width'];
  </code></pre>
  
  <p>But this is printing me nothing. Don't know where I am going wrong but any help would be appreciated.</p>