|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15668 translation of symbol '&' when storing in Mysql
Submitted: 2002-02-22 02:58 UTC Modified: 2002-02-22 12:48 UTC
From: macolet at goldtelevision dot com Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 4.0.5 OS: linux redhat 7.1
Private report: No CVE-ID: None
 [2002-02-22 02:58 UTC] macolet at goldtelevision dot com
In PHP script I have a variable with a string assigned containing the symbol '&' :
$myvariable = 'Smith & Sons';
when I insert the variable in the database :

$query="insert into mytable (mycolumn) values (myvalue1='$myvariable');";


if I edit directly the column in Mysql the symbol '&' has been translated to '&'.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-02-22 12:20 UTC]
Can you provide a sample script? You're very likely doing something wrong...
 [2002-02-22 12:35 UTC] macolet at goldtelevision dot com
the script that causes the problem :
when the string $ragsoc1 contains & in Mysql I found &

while (strpos($ragsoc1,"  "))
 $ragsoc1=str_replace("  "," ",$ragsoc1);
 // print $ragsoc1;
// print $ragsoc1;

// echo '$check1';


if ($recatt_soc==3)
	 $a1="insert into societa (ragsoc1,ragsoc2,indir1,indir2,cap,citta,prov,paese,";
	 $b1="telef1,telef2,fax,note) values ('$ragsoc1','$ragsoc2','$indir1','$indir2',";
    $where_cat="where (IDSOC='$cod')";
    $a1="update societa set ragsoc1='$ragsoc1' , ragsoc2='$ragsoc2', ";
    $b1="indir1='$indir1', indir2='$indir2', cap='$cap', citta='$citta', ";
    $c1="prov='$prov',paese='$paese', telef1='$telef1', telef2='$telef2', fax='$fax', note='$mytext' ";

$query="$a1 $b1 $c1 $where_cat";


// echo $query;

echo "<br>\n";

 or die ("Query errata : "
	// echo $recatt_soc;
 [2002-02-22 12:47 UTC]
The bug system is not the appropriate forum for asking support
questions. For a list of a range of more appropriate places to ask
for help using PHP, please visit

Can't reproduce. 
 [2002-02-22 12:48 UTC]
You may want to try a never version anyway, 4.0.6 or 4.1.1 ...
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jul 14 17:01:28 2024 UTC