Search code examples
phpmysqlcode-snippetsmodxmodx-evolution

ModX: Custom query only works when I update the snippet


I have a script that runs a PHP MySQL query with information gathered via a form. The query works fine but the weird thing is that it wont update the search variables if someone refreshes and enters new input into the form.

I can actually see the correct variables in the URL but they are just not being repeated in the query.

The really odd thing is if I go and edit the snippet in the ModX back end - even if its just adding a comment - save it and refresh the page it works until I try a new search again.

Would anyone know whats happening here?


Solution

  • Is your form snippet cached? You'll need it uncached to have it run fresh every time:

    [[!snippet]]
    

    That goes for any placeholders too:

    [[!+placeholder]]