We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19476
    • 11 Posts
    I have a database containing, amongst others, name, address, telephone number, appointment and I want to be able to search on any of these fields, including a partial search e.g. in the address find anyone who lives in HORS which would return HORSHAM and HORSLEY and have all the relevant records returned.

    I have been looking through various options and thought that AjaxSearch may be the answer but it looks like that only searches for content on the Modx database.

    Can someone point me in the right direction please? I have spent several hours looking through documentation and cannot find a sensible starting point.

    Thanks

    Mike
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      You’ll need a custom snippet to search your database.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 19476
        • 11 Posts
        Thanks Susan, yet again for a very speedy reply to my post.

        So if I understand correctly, I need to write the snippet from scratch. I do have a dreamweaver page with a fair amount of php code to do the same thing (with a lot of security bits as well that modx ’web user’ function can take care of) so would that be a reasonable starting point?

        Mike
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Yes, it would. You’ll probably be able to put 99% of it into a snippet, with a few modifications to allow for how MODx deals with snippets and their output.

          Just take care to keep from getting the databases tangled; you’ll need to close your custom connection to let MODx have its own connection back.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org