title: My PHP Variable that I pulled from a MySQL database keeps returning undefined
body: <p>Hope all is well.</p>
  
  <p>I have had a bit of an issue this evening when I was working on a message system for some project for work.</p>
  
  <p>I'm working on the inbox, and have it set up so that it pulls the message subject, sender, and date of sending in table rows on the front-end. That all works great.</p>
  
  <p>My issue is pulling the message body, which is the actual message content. It's supposed to show up in a modal when the table rows are clicked in the front-end, and I can get that to work without issue. The problem is that I can't pull a non-undefined variable for the message content in the first place.</p>
  
  <p>My SQL table looks like this:</p>
  
  <p><code>msgTo (text)</code>, <code>msgFrom (text)</code>, <code>msgSubject (text)</code>, <code>msgMessage (text)</code>, <code>msgDate (text)</code></p>
  
  <p>My <code>PHP</code> code looks like this:</p>
  
  <pre><code>$msgTo = $row["msgTo"];
  $msgFrom = $row["msgFrom"];
  $msgSubject = $row["msgSubject"];
  $msgTime = $row["msgTime"];
  $msgDate = $row["msgDate"];
  $msg = $row["msgMessage"];
  </code></pre>
  
  <p>If I echo or print any of the variables other than my $msg variable, it works great. But no matter what I try, my $msg variable returns undefined.</p>
  
  <p>The content for the <code>"msgMessage"</code> column in the MySQL table is the following:</p>
  
  <p>"Hello John,</p>
  
  <p>How's it going?"</p>
  
  <p>My best guess is that because unlike all the other variables I'm pulling, this one has line breaks, and maybe it can't handle the equivalent of <code>"\n"</code>? So maybe there is some sort of way I need to sanitize it.</p>
  
  <p>Please let me know if there is more information you need.</p>
  
  <p><strong>SOLUTION</strong>
  My query did not include the variable I was trying to retrieve. It was just one of those silly mistakes that you end up spending too much time on.</p>
  
  <p>If you're just now finding this post, remember to double-check your queries, everyone!</p>