title: apostrophes are breaking my mysql query in PHP
body: <p>My database has name records that occasionally contain apostrophes, such as <code>Joe's Bar</code> and I've just coded a query script in PHP that grabs that field and sticks it into a select statement with the usual <code>$query = "SELECT address FROM restaurants WHERE name='$name'";</code> and the apostrophe in some of the restaurant names derails the Love Train.</p>
  
  <p>How do I keep this from happening?</p>
  
  <p><strong>Snide answer</strong> - Use the same technique you used when you inserted them INTO the database via PHP.<br />
  <strong>Rebuttal</strong> - I was having the same problem then and cheated and entered the troublesome ones directly using PHPMyAdmin but this can't be ignored any longer.</p>
  
  <p>Thank you for taking the time to answer this during the holidays.</p>