We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 44231
    • 126 Posts
    johnrobert27 Reply #1, 13 years ago
    hi there!

    Im having some trouble counting records with my query, can you give some advice to get through with this, Im using this kind of querying in modx.

    here is my code

    $search = $modx->query("SELECT b.form_class, a.system_brand_id, a.system_product_id, b.company, a.system_edition_id, a.brand_name, b.content, c.section1_id, c.section2_id, c.section3_id, c.section4_id,
    MATCH (tfv_records)AGAINST ('$xkeywordx' IN BOOLEAN MODE) AS relevance
    FROM mod_tfvrecords a, mod_tblcontents b, mod_tblproductcategory c
    WHERE MATCH (tfv_records)AGAINST ('$xkeywordx' IN BOOLEAN MODE)
    AND a.system_brand_id = b.system_brands_id
    AND a.system_product_id = c.system_product_id 
    GROUP BY a.system_product_id ORDER BY relevance DESC LIMIT 50
    ");


    thanks!
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      http://rtfm.modx.com/xpdo/2.x/class-reference/xpdo/xpdo.getcount

      or if that isn't what you need, try
      $query->stmt->rowCount();

      https://forums.modx.com/thread/32048/getting-num-rows-from-xpdo

      [ed. note: sottwell last edited this post 13 years ago.]
        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