title: How do you deal with ', single quote in person's names in php, javascript
body: <p>I noticed that some of name entries, like O'Rourke or O'reilly breaks javascript in some cases. I wonder how you deal with it. I pull these names out of PHP/MYSQL and put them in javascript.</p>
  
  <p>Do you replace them before entering to database or after pulling out of database?</p>
  
  <p>Thanks in advance </p>
  
  <pre><code>google.load('visualization', '1', {packages:['table']});
        google.setOnLoadCallback(drawTable);
        function drawTable() {
          var data = new google.visualization.DataTable();
          data.addColumn('string', 'First Name');
          data.addColumn('string', 'Last Name');
          data.addColumn('string', 'email');
          data.addColumn('string', 'Parent email 1');
          data.addColumn('string', 'Parent email 2');
          data.addColumn('string', 'Advisor');
          data.addColumn('string', 'Active');
          data.addColumn('string', 'Edit');
          //data.addColumn('number', '');
          data.addRows([
       &lt;?php
     if(count($items))
     {
          foreach($items as $item)
          {
              foreach($advisors as $key=&gt;$advisor)
              {
                  if($item['advisor']==$advisor['id'])
                  {
                      $ad=$advisor['last_name'];
                  }
              }
              $active_icon = ($item['active']=='1'?'tick':'cross');
              $editlink = anchor('auth/admin/members/form/'.$item['id'],$this-&gt;bep_assets-&gt;icon('pencil'));
              echo "['".$item['first_name']."', '".$item['last_name']."', '".$item['email']
              ."', '".$item['parent_email1']."', '".$item['parent_email2']."', '".$ad."', '".$this-&gt;bep_assets-&gt;icon($active_icon)."','".$editlink."'],";
          }
     }
  
      ?&gt;
  
          ]);
  
          var table = new google.visualization.Table(document.getElementById('table_div'));
          table.draw(data, {showRowNumber: true, allowHtml:true});
        }
  </code></pre>