modx revo snippet variable in query
Posted
by
Meddie
on Stack Overflow
See other posts from Stack Overflow
or by Meddie
Published on 2012-06-29T09:25:32Z
Indexed on
2012/06/29
15:16 UTC
Read the original article
Hit count: 248
I noticed something weird when using a query in a snippet. When I have a query like this:
$sql = 'SELECT * FROM table WHERE colomn = ' . $variable;
And I echo $sql, the query reads:
SELECT * FROM table WHERE colomn = <code class="php plain">2</code>
.. wich will result in an error because the sql is no longer valid. So for now I use strip_tags to remove the code tag, but I find it not a very clean method.
I couldnt find anything about this, so maybe someone can shed some light on this for me?
© Stack Overflow or respective owner