title: How to insert string with single quote in Mysql & Oracle database?
body: <p>I am facing issue in inserting <strong>single quoted value</strong> (say Product Name: xyz80'). So how can I insert such data into <strong>mysql</strong> &amp; <strong>oracle</strong> database. With double quote, it's working fine. eg: xyz90"</p>
  
  <p>My script:</p>
  
  <pre><code>$query2 = "SELECT sfoi.name, sfoi.sku, sfoi.qty_ordered
  FROM  sales_flat_order sfo
  JOIN sales_flat_order_item sfoi
  ON sfoi.order_id = sfo.entity_id
  WHERE sfo.increment_id = 100000473";
  $result_query2 = mysql_query($query2);
  while($row = mysql_fetch_array($result_query2))
  {
       $row["name"] = mysql_real_escape_string($row["name"]);
      // $row["name"] = html_entity_decode($row["name"]);
        $result_str_product .= "('". $row["name"] . "',". "'" . $row["sku"] . "'," . "'" . $row["qty_ordered"]),";
  }
  </code></pre>
  
  <p>I tried using both mysql_real_escape_string() and html_entity_decode(), still getting error.
  Here $row[name] is fetching value which is like xyz80', pqr75' etc. As I am inserting these values through PHP, unable to get where exactly error is occurring.</p>
  
  <p>I am facing similar problem with <strong>Oracle</strong> db also. In Oracle , I tried this: <code>"'". $row["name"] . "'',"</code> using <code>''</code> at the end.</p>
  
  <p>HOW TO insert special characters in Oracle dataabse?</p>