I must do an insert query into a mysql table but I cannot do that because the text that I must insert isin the following format:
Pas d\'informationrd <table border='1' cellpadding='3' cellspacing='0'>
<tr style='text-align:center;'><th rowspan=2>Nom de la pièce</th> <th rowspan=2>Référence</th> <th rowspan=2>Prix</th>
<th colspan='3' style='text-align:center;'>Operations</th></tr><tr><th style='text-align:center;' width='100px'>Code opération</th><th style='text-align:center;' width='100px'>Libellé</th><th style='text-align:center;' width='100px'>Temps</th></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td style='height: 70px'>Commentaire</td><td style='height: 70px' colspan=5></td></tr></table><br>Pas d\'informationrd <table border='1' cellpadding='3' cellspacing='0'>
As you may notice sometimes there are the following characters " \' " and sometimes " ' ".
I tried a PHP replace in the following way:
$response_decoded = str_replace("\\","", $row["ope_response"]);
$text = str_replace("\\","", $row["text"]);
$response_decoded = str_replace("'","\'", $row["ope_response"]);
$text = str_replace("'","\'", $row["text"]);
But it didn't work because only I added a " \ " everywhere:
<br>Pas d\\'informationrd <table border=\'1\' cellpadding=\'3\' cellspacing=\'0\'>
<tr style=\'text-align:center;\'><th rowspan=2>Nom de la pièce</th> <th rowspan=2>Référence</th> <th rowspan=2>Prix</th>
<th colspan=\'3\' style=\'text-align:center;\'>Operations</th></tr><tr><th style=\'text-align:center;\' width=\'100px\'>Code opération</th><th style=\'text-align:center;\' width=\'100px\'>Libellé</th><th style=\'text-align:center;\' width=\'100px\'>Temps</th></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td style=\'height: 70px\'>Commentaire</td><td style=\'height: 70px\' colspan=5></td></tr></table><br>Pas d\\'informationrd <table border=\'1\' cellpadding=\'3\' cellspacing=\'0\'>
As you can imagine, I must substitute every " ' " with " \' " and in the same time every " \' " must remain " \' ".
Can help?