We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21777
    • 9 Posts
    Hi,

    i’m trying to do something like this:

    $var="[+somevar+]";

    $query = "SELECT * FROM table WHERE x = $var";
    echo $query;
    $modx->db->query($query);

    Here ’somevar’ is a placeholder created in another snippet if I leave out the query line everything works fine but with it I get something like

    Execution of a query to the database failed - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ’[+somevar+]’ at line 1

    has anyone managed to do this ?
      • 4002
      • 64 Posts
      $var=$modx->getPlaceholder(’somevar’);
        • 21777
        • 9 Posts
        Thanks smiley