$ret='';\r
$qlen=strlen($query);\r
for ($i=0;$i<$qlen;$i++) {\r
+ // Check MySQL specific comment, '--'.\r
+ $temp=substr($query,$i);\r
+ if (preg_match('/^([^"`\']*)[\r\n]\-\-[\s^\r\n][^\r\n]*/',$temp,$m)) {\r
+ // Found.\r
+ $ret.=preg_replace('/[\s]+/',' ',$m[1]); // Change all spacing to ' '.\r
+ $i += strlen($m[0]);\r
+ continue;\r
+ }\r
// Go to next quote\r
if (($i1=strpos($query,'"',$i))===false) $i1=$qlen;\r
if (($i2=strpos($query,"'",$i))===false) $i2=$qlen;\r
if (($i3=strpos($query,'`',$i))===false) $i3=$qlen;\r
if ($i1==$qlen && $i2==$qlen && $i3==$qlen) {\r
- $temp=preg_replace('/[\s]+/',' ',substr($query,$i)); // Change all spacying to ' '.\r
+ $temp=preg_replace('/[\s]+/',' ',substr($query,$i)); // Change all spacing to ' '.\r
$ret.=($temp);\r
if (strstr($temp,';')) exit('Warning: try to use more than two queries?');\r
break;\r
}\r
if ($i2<($j=$i1)) $j=$i2;\r
if ($i3<$j) $j=$i3;\r
- $temp=preg_replace('/[\s]+/',' ',substr($query,$i,$j-$i)); // Change all spacying to ' '.\r
- // Remove MySQL specific comment, '-- '.\r
- $temp=preg_replace('/($|[\r\n])\-\-[\s^\r\n]([^\r\n]*)/',' ',$temp);\r
+ $temp=preg_replace('/[\s]+/',' ',substr($query,$i,$j-$i)); // Change all spacing to ' '.\r
$ret.=($temp);\r
$c=$query[($i=$j)]; // $c keeps the type of quote.\r
if (strstr($temp,';')) exit('Warning: try to use more than two queries?');\r