title: Session Variable in Select Statement
body: <p>On one page i have it to show the user who logged in username which works perfectly fine. </p>
  
  <pre><code>echo "Welcome, ".$_SESSION['username']
  </code></pre>
  
  <p>I wanna create a Select Statement which uses the same variable as above to pull all data for that user.</p>
  
  <p>Example Username is jsmith@gmail.com</p>
  
  <p><strong>I used this to see if the coding works which it did.</strong></p>
  
  <pre><code>$sql="SELECT * FROM $tbl_name WHERE myusername ='jsmith@gmail.com'";
  $result=mysql_query($sql);
  </code></pre>
  
  <p><strong>But I wanna use the variable; I tried the code below but it didn't work.</strong></p>
  
  <pre><code>$sql="SELECT * FROM $tbl_name WHERE myusername ='$_SESSION['username']'";
  $result=mysql_query($sql);
  </code></pre>
  
  <p>I know for sure it has to do with the SELECT statement using the variable, im not sure if i am relating to the variable correctly.</p>
  
  <p>Help will be greatly appreciated.</p>