mysql_real_escape_string() leaves slashes to my image tag when re submitting page [closed]

StackOverflow https://stackoverflow.com/questions/23501470

  •  16-07-2023
  •  | 
  •  

Domanda

$a = mysql_real_escape_string(strip_list_words($a));

$query = "update r set answer='{$a}' WHERE id = '{$id}'";

When the page gets "saved" (re-submitted) the frame that the "answer" (image) is display goes from:

img src="/Images.php?imageId=b9129d0e96f1be14a4a0" alt="test5.png"

TO

img src="\"/maint/reportsImages.php?imageId=b9129d0e96f1be14a4a0\"" alt="\"test5.png\"">

How can I convert this or change the way it gets saved/refreshed with mysql_real_escape_string

È stato utile?

Soluzione

if (get_magic_quotes_gpc()){
  $a= stripslashes($a);
}
if (function_exists('mysql_real_escape_string')) {
  $query = mysql_real_escape_string($a);
} else {
  $query =  mysql_escape_string($a);
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top