We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24629
    • 370 Posts
    hi,
    i'm trying to do a simple search through some page with a LIKE on the 'content
    $criteria = $modx->newQuery('modResource');
    $criteria->where(array('modResource.content:LIKE ' => '%'. $_POST["keyword"] . '%'));
    $criteria->sortby('menuindex', 'ASC');
    $docArray = $modx->getCollection('modResource', $criteria);

    This doesn't seem to work. Can anyone tell me why?

    Rdg

      • 18373 ☆ A M B ☆
      • 3,141 Posts
      Looks fine to me, though you can probably lose the "modResource." bit in the where array.

      Are you getting any errors in the MODX error log under Reports > Error log?

      I wonder if the space after LIKE could cause issues...
        Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

        Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.