0

I noticed something weird within 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>

.. which 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 to be not a very clean method.

I couldn't find anything about this issue, so maybe someone can shed some light on this for me?

curveball
  • 4,320
  • 15
  • 39
  • 49
Meddie
  • 571
  • 1
  • 7
  • 22

2 Answers2

0

I've never seen revo do anything like that, just using a normal browser to view the page, not some odd tool?

What happens if you:

$sql = "SELECT * FROM table WHERE colomn = '".$variable."';";

Sean Kimball
  • 4,506
  • 9
  • 42
  • 73
0

What are you trying to query with that bare bones SQL? MODX uses XPDO to retrieve their data.

Please try to learn this to get the grip.

http://rtfm.modx.com/display/xPDO20/Retrieving+Objects

It's the basic query for a start.

goldsky
  • 801
  • 7
  • 11