I am facing issue in inserting single quoted value (say Product Name: xyz80'). So how can I insert such data into mysql & oracle database. With double quote, it's working fine. eg: xyz90"
My script:
$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"]),";
}
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.
I am facing similar problem with Oracle db also. In Oracle , I tried this: "'". $row["name"] . "'',"
using ''
at the end.
HOW TO insert special characters in Oracle dataabse?