|
Posted by artev on 09/13/06 20:10
I have this query:
$query = SELECT ID, text
FROM table
WHERE ID>100
AND text = ......;
In the field text I want a filter so:
AND mysql_real_escape_string(text) = ......;
because in the text I have words with ' .
-------------------------------------------------------------------------
notice, I not want to do this:
AND text ='".mysql_real_escape_string($text)."'";
because the problem isn't the $text (I have already change with
mysql_real) but is the field text itself;
in the db (with phpmyadmin) I see the words who have ';
but when i recall with query the field text, there aren't more the
words with ' .
for to verify I have do this:
when I extract the field text,I not see more the words with '
(type book's , apple's ...)
$my_test =SELECT text
FROM table
WHERE 1=1;
foreach ($my_test as $my)
{
echo "<script type='text/javascript'>";
echo "alert( '$my->text' )";
echo "</script>";
}
for take out all the words I have make this
foreach ($my_test as $my)
{$new_var=mysql_real_escape_string($my->text);
echo "<script type='text/javascript'>";
echo "alert( '$new_var' )";
echo "</script>";
}
any idea?
Navigation:
[Reply to this message]
|