6
I am testing the targeting of images with the URL. However, during the tests, the URL was returned with changes as can be seen below:
URL inserted in the database:
http://www.meusite.com.br/pastaimagem/logos/imageLogo.jpg
URL returned by database:
http:\/\/www.meusite.com.br\/pastaimagem\/logos\/imageLogo.jpg
I noticed this problem while testing the query by browser.
Version of PHP:
PHP: 5.4.37
Query used to insert URL:
UPDATE `meusite_sitebd`.`jump` SET `urlimagem` = 'http://www.meusite.com.br/pastaimagem/logos/imageLogo.jpg' WHERE `register`.`idRegistro` =1;
PHP code used to perform the request:
<?php
include 'conexao.php';
//Converte para UTF8 os resultados da query
mysql_set_charset('UTF8');
// Retorna registro por id
$id = $_GET['idRegistro'];
$sql = "SELECT * FROM registros WHERE idRegistro = '$id'";
$resultado = mysql_query($sql) or die ("Erro: ".mysql_error());
// Crinha variável linha do tipo array
$linha = array();
while($r = mysql_fetch_assoc($resultado))
{
$linha [] = $r;
}
echo json_encode($linha);
mysql_close();
?>
As you can see it’s a very simple code.
No. I’m saving only her URL. I’ve actually edited the question. It’s gotten a little confusing, but now it’s more readable. The image is in a directory on the server itself.
– Tiago Amaral
Okay, how are you saving the URL?
– stderr
On the Phpmyadmin screen itself, I edit the record and copy and paste the URL. But on the PHP screen the URL is normal. Only appears with the counterbars when I receive them by request.
– Tiago Amaral
Is Magic Quotes enabled? What version of php? Could you put the code of Insert
– rray
I edited the question and added the code used to update the record and insert the PHP URL and version. I will check the Magic Quotes...
– Tiago Amaral
You don’t happen to have a code
addslashes
putting these bars?– bfavaretto
No. This is the first time I’ve encountered this problem. :/
– Tiago Amaral
I’ll add the code I’m using to the query...
– Tiago Amaral